Skip to content

Issue when running tests after upgrading to 5.2.2 #146

@nikola-lenert

Description

@nikola-lenert

Describe the bug
image

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/document/subscriptions/document-generator.subscriber.spec.ts.

      at Function.dynamicImport (node_modules/@mikro-orm/core/utils/Utils.js:778:20)
      at Function.getConfiguration (node_modules/@mikro-orm/core/utils/ConfigurationLoader.js:28:52)
      at Function.createEntityManager (node_modules/@mikro-orm/nestjs/mikro-orm-core.module.js:121:32)
      at Function.forRoot (node_modules/@mikro-orm/nestjs/mikro-orm-core.module.js:65:20)

Since we upgraded mikro-orm/nestjs to version 5.2.2, the error above occurs 100+ times for various files during the duration of the tests.

Stack trace

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down. From src/document/subscriptions/document-generator.subscriber.spec.ts.

      at Function.dynamicImport (node_modules/@mikro-orm/core/utils/Utils.js:778:20)
      at Function.getConfiguration (node_modules/@mikro-orm/core/utils/ConfigurationLoader.js:28:52)
      at Function.createEntityManager (node_modules/@mikro-orm/nestjs/mikro-orm-core.module.js:121:32)
      at Function.forRoot (node_modules/@mikro-orm/nestjs/mikro-orm-core.module.js:65:20)

To Reproduce

Not sure how to reproduce...

Expected behavior
The error doesn't happen.

Additional context
Works fine on mikro-orm/nestjs 5.1.0.
I tried removing all usage of MikroOrmModule.forRoot across tests but it didn't help.
The issue doesn't seem to affect passing of the tests.
Let me know if I can provide any additional info.

Versions

Dependency Version
node 18
typescript 5.2.2
mikro-orm 5.8.4
your-driver ?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions