I've generated a component in my components folder using the angular CLI (v6.1.4) by running ng g c components/foo
and have then run ng test
. The test for the new component fails with the following errors:
Zone is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/zone.js thrown
Error: Illegal state: Could not load the summary for directive FooComponent.
Oddly, if I run ng g c foo
(i.e. so it's not generated in the components folder), the test then passes. My tests are all working for other folders, but this is the first test in my components folder (and is also the first test for a component). None of the other tests are asynchronous.
I'm fairly new to ng test
so I might be missing something very obvious. I wasn't expecting to need to set up anything with zone.js
for the default test to run. Where should I configure this? Or is there something else I'm missing here, perhaps something specific to my components
folder?
src/test.ts
, and if I remove the 5 imports from a test file then the tests break again. I've never managed to understand this problem unfortunately. – Muco