jest.config.js 842 B

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