41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
export const metadata = {
|
|
title: `Errors When Running Tests`,
|
|
}
|
|
|
|
# {metadata.title}
|
|
|
|
This troubleshooting guide covers common errors you may encounter when running tests in your Medusa application and how to resolve them.
|
|
|
|
## Loaders for module Workflows failed
|
|
|
|
If you get the following error when running your tests:
|
|
|
|
```bash
|
|
Loaders for module Workflows failed: Method Map.prototype.set called on incompatible receiver #<Map>
|
|
```
|
|
|
|
This may occur if you have multiple test files and you don't configure your Jest environment correctly. To resolve this, add the following configuration to your `jest.config.js` file:
|
|
|
|
```js title="jest.config.js"
|
|
module.exports = {
|
|
// ...
|
|
setupFiles: ["./integration-tests/setup.js"],
|
|
}
|
|
```
|
|
|
|
Then, create the `integration-tests/setup.js` file with the following content:
|
|
|
|
<Note>
|
|
|
|
If you're using a version prior to Medusa v2.11.0, change `@medusajs/framework/mikro-orm/core` to `@mikro-orm/core`. Learn more in the [v2.11.0 codemod](!docs!/learn/codemods/replace-imports).
|
|
|
|
</Note>
|
|
|
|
```js title="integration-tests/setup.js"
|
|
const { MetadataStorage } = require("@medusajs/framework/mikro-orm/core")
|
|
|
|
MetadataStorage.clear()
|
|
```
|
|
|
|
Refer to the [Testing Tools](!docs!/learn/debugging-and-testing/testing-tools) guide for more details.
|