Aurelia test setup

One of the questions that the Aurelia command-line interface asks when setting up a new Aurelia application (au new) is whether or not to configure unit-testing. If we answer yes to this question, then all of the testing configuration files and dependencies are installed automatically. In the interests of time, we will not investigate how to retrospectively add unit-testing capabilities to an existing Aurelia application, but will instead assume that this has already been configured.

To run Aurelia unit tests, simply type the following:

au karma

This will invoke the built-in Karma test runner, and execute any tests found in the /test/unit directory that match the filename convention of *spec.js.

The au build command must be executed before any tests are compiled and included in a new test run. Aurelia provides the --watch command-line argument that will automatically re-execute the current command if modifications to files on disk are detected. This means that running au karma --watch will compile and rerun any Karma unit tests automatically when our TypeScript source files are modified. This is a very useful feature that provides instant feedback when writing unit tests.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.175.180