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
@@ -1,5 +1,7 @@
|
||||
import { Column, ColumnOptions, Entity, EntityOptions } from "typeorm"
|
||||
import { featureFlagRouter } from "../loaders/feature-flags"
|
||||
import { Equals, ValidateIf } from "class-validator"
|
||||
import { isDefined } from "@medusajs/utils"
|
||||
|
||||
/**
|
||||
* If that file is required in a non node environment then the setImmediate timer does not exists.
|
||||
@@ -15,7 +17,7 @@ try {
|
||||
console.warn(
|
||||
"[feature-flag-decorator.ts] setImmediate will use a mock, this happen when this file is required in a browser environment and should not impact you"
|
||||
)
|
||||
setImmediate_ = (callback: () => void | Promise<void>) => callback()
|
||||
setImmediate_ = async (callback: () => void | Promise<void>) => callback()
|
||||
}
|
||||
|
||||
export function FeatureFlagColumn(
|
||||
@@ -40,6 +42,10 @@ export function FeatureFlagDecorators(
|
||||
return function (target, propertyName) {
|
||||
setImmediate_((): any => {
|
||||
if (!featureFlagRouter.isFeatureEnabled(featureFlag)) {
|
||||
ValidateIf((o) => isDefined(o[propertyName]))(target, propertyName)
|
||||
Equals(undefined, {
|
||||
message: `${propertyName as string} should not exist`,
|
||||
})(target, propertyName)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user