/ jest.config.js
jest.config.js
 1  const { loadEnv } = require("@medusajs/utils");
 2  loadEnv("test", process.cwd());
 3  
 4  module.exports = {
 5    transform: {
 6      "^.+\\.[jt]s$": [
 7        "@swc/jest",
 8        {
 9          jsc: {
10            parser: { syntax: "typescript", decorators: true },
11          },
12        },
13      ],
14    },
15    testEnvironment: "node",
16    moduleFileExtensions: ["js", "ts", "json"],
17    modulePathIgnorePatterns: ["dist/", "<rootDir>/.medusa/"],
18    setupFiles: ["./integration-tests/setup.js"],
19  };
20  
21  if (process.env.TEST_TYPE === "integration:http") {
22    module.exports.testMatch = ["**/integration-tests/http/*.spec.[jt]s"];
23  } else if (process.env.TEST_TYPE === "integration:modules") {
24    module.exports.testMatch = ["**/src/modules/*/__tests__/**/*.[jt]s"];
25  } else if (process.env.TEST_TYPE === "unit") {
26    module.exports.testMatch = ["**/src/**/__tests__/**/*.unit.spec.[jt]s"];
27  }