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:
@@ -6,11 +6,13 @@ module.exports = {
|
||||
"^@types": "<rootDir>/src/types",
|
||||
},
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": [
|
||||
"ts-jest",
|
||||
"^.+\\.[jt]s$": [
|
||||
"@swc/jest",
|
||||
{
|
||||
tsconfig: "tsconfig.spec.json",
|
||||
isolatedModules: true,
|
||||
jsc: {
|
||||
parser: { syntax: "typescript", decorators: true },
|
||||
transform: { decoratorMetadata: true },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
"jest": "^29.7.0",
|
||||
"medusa-test-utils": "^1.1.42",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^29.1.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsc-alias": "^1.8.6",
|
||||
"typescript": "^5.1.6"
|
||||
|
||||
@@ -5,15 +5,15 @@ import {
|
||||
generateEntityId,
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
Cascade,
|
||||
BeforeCreate,
|
||||
Entity,
|
||||
Filter,
|
||||
ManyToOne,
|
||||
OnInit,
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
Filter,
|
||||
OptionalProps,
|
||||
BeforeCreate,
|
||||
OnInit,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import TaxRate from "./tax-rate"
|
||||
|
||||
@@ -73,7 +73,7 @@ export default class TaxRateRule {
|
||||
reference: string
|
||||
|
||||
@ManyToOne(() => TaxRate, { persist: false })
|
||||
tax_rate: TaxRate
|
||||
tax_rate: Rel<TaxRate>
|
||||
|
||||
@Property({ columnType: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null = null
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import TaxRateRule from "./tax-rate-rule"
|
||||
import TaxRegion from "./tax-region"
|
||||
@@ -63,10 +64,10 @@ export default class TaxRate {
|
||||
name: string
|
||||
|
||||
@Property({ columnType: "bool", default: false })
|
||||
is_default = false
|
||||
is_default: boolean = false
|
||||
|
||||
@Property({ columnType: "bool", default: false })
|
||||
is_combinable = false
|
||||
is_combinable: boolean = false
|
||||
|
||||
@ManyToOne(() => TaxRegion, {
|
||||
columnType: "text",
|
||||
@@ -78,12 +79,12 @@ export default class TaxRate {
|
||||
tax_region_id: string
|
||||
|
||||
@ManyToOne({ entity: () => TaxRegion, persist: false })
|
||||
tax_region: TaxRegion
|
||||
tax_region: Rel<TaxRegion>
|
||||
|
||||
@OneToMany(() => TaxRateRule, (rule) => rule.tax_rate, {
|
||||
cascade: ["soft-remove" as Cascade],
|
||||
})
|
||||
rules = new Collection<TaxRateRule>(this)
|
||||
rules = new Collection<Rel<TaxRateRule>>(this)
|
||||
|
||||
@Property({ columnType: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null = null
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
Rel,
|
||||
} from "@mikro-orm/core"
|
||||
import TaxProvider from "./tax-provider"
|
||||
import TaxRate from "./tax-rate"
|
||||
@@ -65,7 +66,7 @@ export default class TaxRegion {
|
||||
provider_id: string | null = null
|
||||
|
||||
@ManyToOne(() => TaxProvider, { persist: false })
|
||||
provider: TaxProvider
|
||||
provider: Rel<TaxProvider>
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text" })
|
||||
@@ -85,7 +86,7 @@ export default class TaxRegion {
|
||||
parent_id: string | null = null
|
||||
|
||||
@ManyToOne(() => TaxRegion, { persist: false })
|
||||
parent: TaxRegion
|
||||
parent: Rel<TaxRegion>
|
||||
|
||||
@OneToMany(() => TaxRate, (label) => label.tax_region, {
|
||||
cascade: ["soft-remove" as Cascade],
|
||||
@@ -95,7 +96,7 @@ export default class TaxRegion {
|
||||
@OneToMany(() => TaxRegion, (label) => label.parent, {
|
||||
cascade: ["soft-remove" as Cascade],
|
||||
})
|
||||
children = new Collection<TaxRegion>(this)
|
||||
children = new Collection<Rel<TaxRegion>>(this)
|
||||
|
||||
@Property({ columnType: "jsonb", nullable: true })
|
||||
metadata: Record<string, unknown> | null = null
|
||||
|
||||
Reference in New Issue
Block a user