DEV Community

loading...

Failed: Type X is part of the declarations of 2 modules: AppModule and DynamicTestModule

John Peters
Lit-Html or Svelte?
Updated on ・1 min read

When writing Jasmine tests, the message above is common. The failed test looks like this:

failed test case

Root Cause

AppModule already declares the component under test!

rootcause

Resolve

Remove the declaration in the jasmine file; shown below:
Same test as shown above, with missing 2nd declaration.

solution

Easy right?

JWP2019

Discussion (0)