mercredi 17 avril 2019

How do I find out why my angular tests fail in afterAll?

I have an angular 7 app which I recently wrote tests for. When executing them I run into an error in "afterAll".

If it were inside of one of the test-cases I could debug it easily. But in this case I don't know whats actually going wrong.

This is the relevant part of the console:

HeadlessChrome 73.0.3683 (Ubuntu 0.0.0): Executed 89 of 131 SUCCESS (0 secs / 2.193 secs)
HeadlessChrome 73.0.3683 (Ubuntu 0.0.0) ERROR
  An error was thrown in afterAll
  Uncaught Error: No component factory found for TableBodyComponent. Did you add it to @NgModule.entryComponents? thrown
HeadlessChrome 73.0.3683 (Ubuntu 0.0.0): Executed 131 of 131 ERROR (0 secs / 3.495 secs)
HeadlessChrome 73.0.3683 (Ubuntu 0.0.0) ERROR
  An error was thrown in afterAll
  Uncaught Error: No component factory found for TableBodyComponent. Did you add it to @NgModule.entryComponents? thrown
HeadlessChrome 73.0.3683 (Ubuntu 0.0.0): Executed 131 of 131 ERROR (4.409 secs / 3.495 secs)
17 04 2019 14:46:26.548:DEBUG [launcher]: CAPTURED -> BEING_KILLED
17 04 2019 14:46:26.548:DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED
17 04 2019 14:46:26.548:DEBUG [karma-server]: Run complete, exiting.
17 04 2019 14:46:26.549:DEBUG [launcher]: Disconnecting all browsers
17 04 2019 14:46:26.549:DEBUG [launcher]: BEING_FORCE_KILLED -> BEING_FORCE_KILLED
17 04 2019 14:46:26.641:DEBUG [launcher]: Process ChromiumHeadless exited with code null and signal SIGTERM
17 04 2019 14:46:26.641:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-52943078
17 04 2019 14:46:26.667:DEBUG [launcher]: Finished all browsers
17 04 2019 14:46:26.667:DEBUG [launcher]: BEING_FORCE_KILLED -> FINISHED
17 04 2019 14:46:26.667:DEBUG [launcher]: FINISHED -> FINISHED
17 04 2019 14:46:26.669:DEBUG [karma-server]: Received stop event, exiting.
17 04 2019 14:46:26.669:DEBUG [launcher]: Disconnecting all browsers
17 04 2019 14:46:26.670:DEBUG [launcher]: FINISHED -> BEING_FORCE_KILLED

I already downgraded my jasmine-version to 2.99 as that seemed to work for other people with similar problems. But it didn't have any effect for me.

"TableBodyComponent" ist a component that is dynamically created and in the app.module.ts it is added to "entryComponents".

For all components that use it, I added it to "providers" in their respective spec-files.

Do I have to add "TableBodyComponent" somewhere else?

Am I doing something else wrong?

Aucun commentaire:

Enregistrer un commentaire