I have a vanilla Angular7 project that was generated via ng
CLI and in there I have a component that I would like to test: src/app/mini-cal/mini-cal.component.spec.ts
I don't know of any way to ask angular cli tool to do this for me, the following combinations failed:
ng test --specs='src/app/mini-cal/mini-cal.component.spec.ts'
ng test -- --specs='src/app/mini-cal/mini-cal.component.spec.ts'
So I decided to point protractor
at it like so:
protractor e2e/protractor.conf.js --specs='src/app/mini-cal/mini-cal.component.spec.ts'
which worked in getting at the file of interest but its missing additional configuration for:
zone
- Failed: 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
- testbed initialization
- Failed: Cannot read property 'injector' of null
Usually all of this is available in src/test.ts
and used by ng test
automatically ... but now that I'm starting the process via protractor
, I need to incorporate it into my e2e/protractor.conf.js
file's onPrepare()
method somehow.
How can I accomplish this?