|
1
|
export const metadata = { |
|
2
|
title: `Errors When Running Tests`, |
|
3
|
} |
|
4
|
|
|
5
|
# {metadata.title} |
|
6
|
|
|
7
|
This troubleshooting guide covers common errors you may encounter when running tests in your Medusa application and how to resolve them. |
|
8
|
|
|
9
|
## Loaders for module Workflows failed |
|
10
|
|
|
11
|
If you get the following error when running your tests: |
|
12
|
|
|
13
|
```bash |
|
14
|
Loaders for module Workflows failed: Method Map.prototype.set called on incompatible receiver #<Map> |
|
15
|
``` |
|
16
|
|
|
17
|
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: |
|
18
|
|
|
19
|
```js title="jest.config.js" |
|
20
|
module.exports = { |
|
21
|
// ... |
|
22
|
setupFiles: ["./integration-tests/setup.js"], |
|
23
|
} |
|
24
|
``` |
|
25
|
|
|
26
|
Then, create the `integration-tests/setup.js` file with the following content: |
|
27
|
|
|
28
|
<Note> |
|
29
|
|
|
30
|
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). |
|
31
|
|
|
32
|
</Note> |
|
33
|
|
|
34
|
```js title="integration-tests/setup.js" |
|
35
|
const { MetadataStorage } = require("@medusajs/framework/mikro-orm/core") |
|
36
|
|
|
37
|
MetadataStorage.clear() |
|
38
|
``` |
|
39
|
|
|
40
|
Refer to the [Testing Tools](!docs!/learn/debugging-and-testing/testing-tools) guide for more details. |