Back to Medusa

{metadata.title}

www/apps/resources/app/troubleshooting/test-errors/page.mdx

2.14.21.2 KB
Original Source

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
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.

</Note>
js
const { MetadataStorage } = require("@medusajs/framework/mikro-orm/core")

MetadataStorage.clear()

Refer to the Testing Tools guide for more details.