feat(medusa): migrate medusa unit tests / plugins integration tests to swc jest (#6820)
what: - migrates medusa package to swc/jest - migrates plugins integration tests to swc/jest - parallelises a few of the heavy test packages - fixes typeorm circular dependencies **Unit Tests** Before: 1 job => ~30 mins After: 2 jobs => ~5 mins <img width="260" alt="Screenshot 2024-03-25 at 15 11 49" src="https://github.com/medusajs/medusa/assets/5105988/e1df6985-5bd6-48d0-b87b-336d3c77d0cf"> **Plugins** Before: 1 job => ~10 mins After: 1 job => ~5 mins <img width="254" alt="Screenshot 2024-03-25 at 15 26 03" src="https://github.com/medusajs/medusa/assets/5105988/c1cec0e2-a1c3-41d1-9372-46d114d804c6"> Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
26531c5a38
commit
509ddf9a56
@@ -178,7 +178,7 @@ describe("/store/carts", () => {
|
||||
})
|
||||
|
||||
const customer = await simpleCustomerFactory(dbConnection, {}, 100)
|
||||
|
||||
const items = []
|
||||
const cart = await simpleCartFactory(dbConnection, {
|
||||
email: "testme@email.com",
|
||||
region: regionId,
|
||||
@@ -194,7 +194,6 @@ describe("/store/carts", () => {
|
||||
],
|
||||
})
|
||||
|
||||
const items = []
|
||||
for (let i = 0; i < 13; i++) {
|
||||
const product = await simpleProductFactory(dbConnection, {})
|
||||
await prodVarInventoryService.attachInventoryItem(
|
||||
|
||||
@@ -14,8 +14,8 @@ module.exports = {
|
||||
`__testfixtures__`,
|
||||
`.cache`,
|
||||
],
|
||||
transformIgnorePatterns: [`/dist`],
|
||||
transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
|
||||
transformIgnorePatterns: ["/dist", "/node_modules/"],
|
||||
transform: { "^.+\\.[jt]s$": `@swc/jest` },
|
||||
setupFiles: ["../setup-env.js"],
|
||||
setupFilesAfterEnv: ["../setup.js"],
|
||||
globalSetup: "../globalSetup.js",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test:integration": "node --expose-gc ./../../node_modules/.bin/jest --silent=false --runInBand --bail --detectOpenHandles --logHeapUsage --clearMocks --forceExit",
|
||||
"test:integration": "jest --silent=false --maxWorkers=50% --bail --detectOpenHandles --clearMocks --forceExit",
|
||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -40,6 +40,8 @@
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"@medusajs/types": "workspace:^",
|
||||
"@swc/core": "^1.4.8",
|
||||
"@swc/jest": "^0.2.36",
|
||||
"babel-preset-medusa-package": "*",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-node": "26.6.2"
|
||||
|
||||
Reference in New Issue
Block a user