@emarketeer/ts-microservice-commons 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-esm-warmup.mjs","sources":["../../src/lib/jest-esm-warmup.ts"],"sourcesContent":["// Runs at worker module-load phase (before beforeAll) when\n// EM_JEST_ESM_FRIENDLY=true. Populates runtime-commons' internal\n// MikroORM / MySqlDriver closure variables so its lazy loader's\n// `if (!MikroORM)` short-circuits during test execution — the\n// dynamic import() never fires, so Jest's ESM teardown invariant\n// can't race it.\nimport { preloadMikroOrmModules } from '@eMarketeerSE/runtime-commons'\n\nawait preloadMikroOrmModules()\n"],"names":[],"mappings":";;AAAA;AAQA,MAAM,sBAAsB,EAAE"}
|
package/dist/lib/jest.config.js
CHANGED
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
// Must match the set of TS extensions transformed above (^.+\.tsx?$), or Jest
|
|
52
52
|
// will load .tsx as CJS while ts-jest emits ESM for it and blow up at import.
|
|
53
53
|
config.extensionsToTreatAsEsm = ['.ts', '.tsx'];
|
|
54
|
+
// Preload runtime-commons' MikroORM modules during the worker's stable
|
|
55
|
+
// module-load phase so lazy loaders short-circuit at test time — avoids
|
|
56
|
+
// Jest's ESM teardown invariant racing dynamic imports in MikroORM.
|
|
57
|
+
config.setupFiles = [require.resolve('./jest-esm-warmup.mjs')];
|
|
54
58
|
}
|
|
55
59
|
var shouldAddSetup = !process.argv.includes('unit');
|
|
56
60
|
if (shouldAddSetup) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|