Where I spend a couple hours learning that I don’t know what I’m doing.
After my dive into the configuration files I felt like I had a pretty strong base to start from. I know what packages I’m using and what they do. I started by tweaking one end to end test to expect ‘Small Catechism Flash Cards’ as the header, compiled (missed that the e2e test script didn’t compile automatically), ran the e2e test, and saw a failure. I then changed the Angular component, compiled, and ran the test and voila it passed. BDD at its finest! (Obviously my overconfidence was setting me up for failure.)
I thought, “Why not try to display a card, and so I don’t get too far ahead, just the title of the card and what would be the front text.” So I wrote a test that looked for ‘The Ten Commandments’ in an h1 and ‘The Introduction’ in an h2. The URL to access would have the form /set/1/1 (set for the resource
The URL format lead me to investigate how to respond to the /set/
I looked at the example some more and I don’t think this is the way I’m supposed to be writing the angular app or using routers. I’m going to pull back a little bit and study the philosophy of what makes a good Angular app, the proper use of components, and how to use routers.
tslint.json setups the linter for TypeScript code.
Discussing this file would just be going over minutae. The parameters are pretty self explanatory. I’ve never used a linter and relied on manual adherence to any coding standard. I’m not sure I will use it, but it might be interesting to see how my style differs from the default style and if I like the defaults. I will be impressed if I find lint useful enough that I end up changing some of the defaults.
To configure Karma, the test runner, there are karma.conf.js and karma-test-shim.js.
First, the ‘framework’ is set to Jasmine. Then karma-jasmine, karma-chrome-launcher, and karma-htmlfile-reporter are set as required plugins and ‘customLaunchers’ is set to launch the Chrome browser.
Next there is a big block that tells which files are to be sent to the browser and which are to be served by the Karma webserver.
The next interesting configuration is for the reporters which is set to ‘progress’ and also ‘html’ which is configured in the next block and is set to output a tests.html file at the end of the test run.
Lastly, some miscellaneous items like the the port, colors (for reporters and logs), logLevel, autoWatch (for automatically running the tests if a file changes, the browser (Chrome), and singleRun which tells Karma to run the tests once and then exit (false).