Angular CLI
Starting Wallaby
To start Wallaby in VS Code you may run Select Configuration
command and then select Automatic Configuration <project directory>
option once. After that you may keep using Wallaby Start
command as usual and it will start Wallaby with automatic configuration.
To start Wallaby in Sublime Text you may use the Select for Wallaby.js Automatic Configuration
context menu item for your project folder in the project’s file tree. After that you may keep using Wallaby Start
command as usual and it will start Wallaby with automatic configuration.
To start Wallaby in Visual Studio, you may use the Start Wallaby.js (Automatic Configuration)
context menu item for your project folder in the Solution Explorer. After the first start,
the selected project will be remembered for your solution and Wallaby can be started with Tools->Start Wallaby.js (Alt-W, 1)
.
To start Wallaby in JetBrains IDEs, you may edit (or create a new) wallaby.js Run Configuration
by selecting Edit configurations
from the drop-down menu in the top right-hand corner of the navigation bar, or from the Run menu. In the run configuration editor set Configuration Type
filed value to Automatic
.
Automatic Configuration Workspace Overrides
When using Automatic Configuration to run tests for the entire workspace, Wallaby creates merged virtual copies of test.ts
, polyfills.ts
and tsconfig.spec.json
files. If these
files have been modified then it is possible they cannot be merged. Wallaby supports the ability to explicitly define the merged contents of these files.
To explicitly override the merged contents of test.ts
, polyfills.ts
and tsconfig.spec.json
, you must create an override file for each file name.
For example, to replace the merged override of all test.ts
files, you must create a file in the workspace root named test.wallaby.ts
. The same is true
for polyfills.ts
and tsconfig.spec.json
which become polyfills.wallaby.ts
and tsconfig.wallaby.spec.json
respectively.
Example merge override for test.ts
test.wallaby.ts
Example merge override for polyfills.ts
polyfills.wallaby.ts
Example merge override for tsconfig.spec.json
tsconfig.wallaby.spec.json
If you have created a polyfills.wallaby.ts
override, then it must be added to your TypeScript files
configuration section.
Automatic Configuration Project Overrides
When using Automatic Configuration to run tests for a specific project, Wallaby slightly modifies your project’s test.ts
file. Wallaby has its own
mechanism for resolving test files and removes the code that provides webpack with the list of tests to run. If this file has been
modified then it is possible that Wallaby cannot safely find/delete this code then Angular CLI defaults for test.ts
will be used.
If desired, you can provide Wallaby with a differnet file to run by creating a test.wallaby.ts
file in the same folder as your
test.ts
file.
Example override for: test.ts
test.wallaby.ts
Jest
If you have configured your project to use Angular Jest Builder or are using an Nx/Nrwl workspace, you can use Wallaby without any configuration.
If you have a custom configuration Angular/Jest configuration then please refer to our Jest docs.
Manual Configuration for versions of Angular prior to v8.2.0
If you are not using Automatic Configuration to run your Angular CLI project’s test, then you must provide a configuration file that tells Wallaby how to load and run your tests. We have created a configuration file that works for Angular CLI projects that use karma as the test runner.
Copy the configuration shown below and paste it into a file named wallaby.js
in your project
root. The configuration file below may seem foreign or scary but you don’t need to worry about
what the configuration file is doing in order to use Wallaby.js with Angular.
You may read more about how to configure wallaby in our configuration settings docs.