chore: move to swc/jest (#7739)
* chore: move to swc * chore: fix tax rate tests * chore: undo failed test * chore: fix unit tests script * chore: use node 20 * Update scripts/run-workspace-unit-tests-in-chunks.sh
This commit is contained in:
1 parent
f61557712c
commit
03924a4ff6
137 files changed
+386
-419
No files matched your search
@@ -1,13 +1,5 @@
|
||||
module.exports = {
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: "tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
transform: { "^.+\\.[jt]s?$": "@swc/jest" },
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `ts`],
|
||||
}
|
||||
@@ -24,7 +24,6 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -84,7 +84,7 @@ export type RegisterModuleJoinerConfig =
|
||||
| ModuleJoinerConfig
|
||||
| ((modules: ModuleJoinerConfig[]) => ModuleJoinerConfig)
|
||||
|
||||
export class MedusaModule {
|
||||
class MedusaModule {
|
||||
private static instances_: Map<string, { [key: string]: IModuleService }> =
|
||||
new Map()
|
||||
private static modules_: Map<string, ModuleAlias[]> = new Map()
|
||||
@@ -589,4 +589,6 @@ export class MedusaModule {
|
||||
}
|
||||
|
||||
global.MedusaModule ??= MedusaModule
|
||||
exports.MedusaModule = global.MedusaModule
|
||||
const GlobalMedusaModule = global.MedusaModule as typeof MedusaModule
|
||||
|
||||
export { GlobalMedusaModule as MedusaModule }
|
||||
@@ -63,7 +63,7 @@ export class RemoteLink {
|
||||
)
|
||||
}
|
||||
|
||||
for (const mod of modulesLoaded) {
|
||||
for (const mod of modulesLoaded || []) {
|
||||
this.addModule(mod)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class RemoteQuery {
|
||||
)
|
||||
}
|
||||
|
||||
for (const mod of modulesLoaded) {
|
||||
for (const mod of modulesLoaded || []) {
|
||||
if (!mod.__definition.isQueryable) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
module.exports = {
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: "tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
transform: { "^.+\\.[jt]s?$": "@swc/jest" },
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `ts`],
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -32,7 +32,7 @@ export class GlobalWorkflow extends WorkflowManager {
|
||||
} else if (Array.isArray(modulesLoaded) && modulesLoaded.length) {
|
||||
container = createMedusaContainer()
|
||||
|
||||
for (const mod of modulesLoaded) {
|
||||
for (const mod of modulesLoaded || []) {
|
||||
const registrationName = mod.__definition.registrationName
|
||||
container.register(registrationName, asValue(mod))
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class LocalWorkflow {
|
||||
} else if (Array.isArray(modulesLoaded) && modulesLoaded.length) {
|
||||
container = createMedusaContainer()
|
||||
|
||||
for (const mod of modulesLoaded) {
|
||||
for (const mod of modulesLoaded || []) {
|
||||
const registrationName = mod.__definition.registrationName
|
||||
container.register(registrationName, asValue(mod))
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
TransactionStepsDefinition,
|
||||
} from "../transaction"
|
||||
import { WorkflowScheduler } from "./scheduler"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
|
||||
export interface WorkflowDefinition {
|
||||
id: string
|
||||
@@ -51,7 +50,7 @@ export type WorkflowStepHandler = (
|
||||
args: WorkflowStepHandlerArguments
|
||||
) => Promise<unknown>
|
||||
|
||||
export class WorkflowManager {
|
||||
class WorkflowManager {
|
||||
protected static workflows: Map<string, WorkflowDefinition> = new Map()
|
||||
protected static scheduler = new WorkflowScheduler()
|
||||
|
||||
@@ -79,10 +78,7 @@ export class WorkflowManager {
|
||||
|
||||
static getTransactionDefinition(workflowId): OrchestratorBuilder {
|
||||
if (!WorkflowManager.workflows.has(workflowId)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_FOUND,
|
||||
`Workflow with id "${workflowId}" not found.`
|
||||
)
|
||||
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
||||
}
|
||||
|
||||
const workflow = WorkflowManager.workflows.get(workflowId)!
|
||||
@@ -232,4 +228,6 @@ export class WorkflowManager {
|
||||
}
|
||||
|
||||
global.WorkflowManager ??= WorkflowManager
|
||||
exports.WorkflowManager = global.WorkflowManager
|
||||
const GlobalWorkflowManager = global.WorkflowManager
|
||||
|
||||
export { GlobalWorkflowManager as WorkflowManager }
|
||||
@@ -1,13 +1,5 @@
|
||||
module.exports = {
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: "tsconfig.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
transform: { "^.+\\.[jt]s?$": "@swc/jest" },
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `ts`],
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LocalWorkflow } from "@medusajs/orchestration"
|
||||
import { LoadedModule, MedusaContainer } from "@medusajs/types"
|
||||
import { ExportedWorkflow } from "./helper"
|
||||
|
||||
export class MedusaWorkflow {
|
||||
class MedusaWorkflow {
|
||||
static workflows: Record<
|
||||
string,
|
||||
(
|
||||
@@ -28,4 +28,6 @@ export class MedusaWorkflow {
|
||||
}
|
||||
|
||||
global.MedusaWorkflow ??= MedusaWorkflow
|
||||
exports.MedusaWorkflow = global.MedusaWorkflow
|
||||
const GlobalMedusaWorkflow = global.MedusaWorkflow
|
||||
|
||||
export { GlobalMedusaWorkflow as MedusaWorkflow }
|
||||
Reference in new issue
Block a user