DEV Community

Rudolf Olah
Rudolf Olah

Posted on • Updated on

Angular Karma Tests Running Twice (or More Times)

Just ran into this issue where Karma test runner looked like it was running multiple times.

It turns out that the Angular CLI command for running tests, ng test will run all projects defined rather than just the default project from angular.json.

This causes some weirdness when you have file-watching turned on.

If you have 2 projects, the 1st project's tests will run and then will re-compile on any files changed. The 2nd project's tests will not run until you press Ctrl+C and then you will see them run.

There's an answer to this problem on StackOverflow: https://stackoverflow.com/a/59127114/9903

Latest comments (0)