Files
medusa-store/integration-tests/setup-env.js
Riqwan Thamir 4c98545ab3 feat: shard modules and API integration tests (#6775)
what:

- runs module and api integration tests in matrix strategy
  - v28 of jest comes with sharding support, which we can utilize when we upgrade
- splits the tests by number of matrix jobs and run them in parallel
  - This introduced some flakiness in some specs, but couldn't reproduce locally. Those have been skipped for now.
- uses swc/jest for added performance
  - Locally, a chunk took 90 seconds with babel and 30 seconds with swc. 
  - This translated to 2 mins saved per shard in CI, but haven't tested this enough.
2024-03-22 11:15:01 +00:00

12 lines
411 B
JavaScript

const path = require("path")
require("dotenv").config({ path: path.join(__dirname, ".env.test") })
if (typeof process.env.DB_TEMP_NAME === "undefined") {
const tempName = parseInt(process.env.JEST_WORKER_ID || "1")
const chunkNumber = parseInt(process.env.CHUNK || "1")
process.env.DB_TEMP_NAME = `medusa-integration-${tempName}-${chunkNumber}`
}
global.performance = require("perf_hooks").performance