feat(medusa-payment-paypal,medusa-payment-stripe): speed up unit tests in CI (#6806)
* chore: shard unit tests * chore: move paypal and stripe to swc * chore: update actions * chore: refactor http paypal client * chore: added changeset * chore: remove medusa changes
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es5",
|
||||
"parser": {
|
||||
"syntax": "typescript"
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "commonjs"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,8 @@
|
||||
module.exports = {
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
tsconfig: "tsconfig.spec.json",
|
||||
isolatedModules: false,
|
||||
},
|
||||
},
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": "ts-jest",
|
||||
"^.+\\.[jt]s?$": "@swc/jest",
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
"/node_modules/(?!(axios)/).*"
|
||||
],
|
||||
transformIgnorePatterns: ["/node_modules/(?!(axios)/).*", "dist"],
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
|
||||
moduleFileExtensions: [`js`, `ts`],
|
||||
}
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prepublishOnly": "cross-env NODE_ENV=production tsc --build",
|
||||
"test": "jest --passWithNoTests src",
|
||||
"test": "jest --runInBand --bail --forceExit",
|
||||
"build": "rimraf dist && tsc",
|
||||
"watch": "tsc --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@medusajs/medusa": "^1.12.2",
|
||||
"@medusajs/types": "^1.8.10",
|
||||
"@swc/core": "^1.4.8",
|
||||
"@swc/jest": "^0.2.36",
|
||||
"@types/stripe": "^8.0.417",
|
||||
"cross-env": "^5.2.1",
|
||||
"jest": "^25.5.4",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Logger } from "@medusajs/medusa"
|
||||
import axios, { AxiosInstance, AxiosRequestConfig, Method } from "axios"
|
||||
import {
|
||||
PaypalApiPath,
|
||||
PaypalEnvironmentPaths,
|
||||
PaypalSdkOptions,
|
||||
} from "./types"
|
||||
import { Logger } from "@medusajs/medusa"
|
||||
|
||||
const MAX_ATTEMPTS = 2
|
||||
|
||||
@@ -31,15 +31,7 @@ export class PaypalHttpClient {
|
||||
this.httpClient_ = new Proxy(axiosInstance, {
|
||||
// Handle automatic retry mechanism
|
||||
get: (target, prop) => {
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
const original = Reflect.get(...arguments)
|
||||
|
||||
if ("request" === (prop as string)) {
|
||||
return this.retryIfNecessary(original)
|
||||
}
|
||||
|
||||
return original
|
||||
return this.retryIfNecessary(target[prop].bind(target))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": "ts-jest",
|
||||
"^.+\\.[jt]s?$": "@swc/jest",
|
||||
},
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
|
||||
moduleFileExtensions: [`js`, `ts`, `json`],
|
||||
modulePathIgnorePatterns: ["dist", "node_modules"],
|
||||
}
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prepublishOnly": "cross-env NODE_ENV=production tsc --build",
|
||||
"test": "jest --passWithNoTests src",
|
||||
"test": "jest --runInBand --bail --forceExit",
|
||||
"build": "rimraf dist && tsc -p ./tsconfig.server.json && medusa-admin bundle",
|
||||
"watch": "tsc --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@medusajs/admin": "^7.1.10",
|
||||
"@medusajs/medusa": "^1.20.3",
|
||||
"@swc/core": "^1.4.8",
|
||||
"@swc/jest": "^0.2.36",
|
||||
"@tanstack/react-table": "^8.7.9",
|
||||
"@types/stripe": "^8.0.417",
|
||||
"awilix": "^8.0.1",
|
||||
|
||||
Reference in New Issue
Block a user