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:
Riqwan Thamir
2024-06-20 12:59:33 +02:00
committed by GitHub
parent f61557712c
commit 03924a4ff6
137 changed files with 386 additions and 419 deletions
@@ -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 }