DEV Community

JWP
JWP

Posted on • Edited on

1 1

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

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

Top comments (1)

Collapse
 
mikel_hamer_50f46faf752f0 profile image
Mikel Hamer

OMG THANK YOU SO MUCH

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay