criollo/jest.config.js

27 lines
772 B
JavaScript
Raw Normal View History

2024-10-16 10:06:47 +00:00
const { loadEnv } = require("@medusajs/utils");
loadEnv("test", process.cwd());
2024-10-09 12:41:16 +00:00
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: { syntax: "typescript", decorators: true },
},
},
],
},
testEnvironment: "node",
moduleFileExtensions: ["js", "ts", "json"],
modulePathIgnorePatterns: ["dist/"],
2024-10-16 10:06:47 +00:00
};
2024-10-09 12:41:16 +00:00
if (process.env.TEST_TYPE === "integration:http") {
2024-10-16 10:06:47 +00:00
module.exports.testMatch = ["**/integration-tests/http/*.spec.[jt]s"];
2024-10-09 12:41:16 +00:00
} else if (process.env.TEST_TYPE === "integration:modules") {
2024-10-16 10:06:47 +00:00
module.exports.testMatch = ["**/src/modules/*/__tests__/**/*.[jt]s"];
2024-10-09 12:41:16 +00:00
} else if (process.env.TEST_TYPE === "unit") {
2024-10-16 10:06:47 +00:00
module.exports.testMatch = ["**/src/**/__tests__/**/*.unit.spec.[jt]s"];
}