A quick tip to save you wasting time wondering why Karma isn’t running your test.
I was expecting to see tests under this heading in Karma
HeroesComponent (shallow tests - child component)
But as the output from Karma shows, this test suite is not displayed.
I checked and double checked the test code, watch the clip of the code being written but couldn’t work out why Karma was not running any of the tests in the file. Other tests in different files ran fine.
Took a break and when I came back the problem was staring back at me. The test file name had a typo which meant that it was invisible to Karma.
The incorrect filename was:
The typo is .spet.ts. Changing this to .spec.ts as shown below
and now I can see the tests being run.
The Angular documentation states the test file extension must be .spec.ts