jest.config.js 794 B

1234567891011121314151617181920212223242526
  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. };
  18. if (process.env.TEST_TYPE === "integration:http") {
  19. module.exports.testMatch = ["**/integration-tests/http/*.spec.[jt]s"];
  20. } else if (process.env.TEST_TYPE === "integration:modules") {
  21. module.exports.testMatch = ["**/src/modules/*/__tests__/**/*.[jt]s"];
  22. } else if (process.env.TEST_TYPE === "unit") {
  23. module.exports.testMatch = ["**/src/**/__tests__/**/*.unit.spec.[jt]s"];
  24. }