#How to instantiate AppModule before testing?

1 messages · Page 1 of 1 (latest)

round tree
#

Hi everyone!
In order to perform tests on my project, I would like to instantiate AppModule as it's made during dev/prod execution, then launching the tests of different services. For the moment, if I understand well, Jest is running each file separately, using imports & cie who are specified in the .spec.ts file currently handled, but with this, it's not possible to test if the [component].module.ts is correctly working.

Therefore, do you know if it's possible to run the app as if it was a normal launch, but then launching the Jest tests, with everything ready?

THanks a lot!

#

How to instantiate AppModule before testing?

#

(don't really know how to call this topic, don't hesitate if you have a better idea!)

minor mountain
#

Do you mean to launch the entire app in a test? There's nothing special about it, you can just import the AppModule inside a testing module:

Test.createTestingModule({
  imports: [AppModule]
})