@emarketeer/ts-microservice-commons 8.2.1 → 8.2.2

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.
@@ -51,10 +51,21 @@
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
+ // Do not preload runtime-commons' MikroORM loaders via `setupFiles`.
55
+ // That preload still goes through a dynamic `import()`, which Jest routes
56
+ // through its `importModuleDynamically` handler the handler re-asserts
57
+ // the per-file VM context on every call. The Function-constructor closure
58
+ // inside runtime-commons' CJS helper is bound to the first test file's
59
+ // VM; a second file on the same worker hits "Test environment has been
60
+ // torn down" on multi-file parallel runs (whether fired from beforeAll
61
+ // or from a setup file).
62
+ //
63
+ // Consumers who need a stable MikroORM init under Jest ESM should import
64
+ // the ESM-only subpath, which uses static imports routed through Jest's
65
+ // per-file module-load path (`loadEsmModule`):
66
+ //
67
+ // // src/db/orm-init.ts
68
+ // import { getMikroOrmMySqlConnection } from '@eMarketeerSE/runtime-commons/mikroorm-esm'
58
69
  }
59
70
  var shouldAddSetup = !process.argv.includes('unit');
60
71
  if (shouldAddSetup) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emarketeer/ts-microservice-commons",
3
- "version": "8.2.1",
3
+ "version": "8.2.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "bin": {
@@ -1,5 +0,0 @@
1
- import { preloadMikroOrmModules } from '@eMarketeerSE/runtime-commons';
2
-
3
- // Runs at worker module-load phase (before beforeAll) when
4
- await preloadMikroOrmModules();
5
- //# sourceMappingURL=jest-esm-warmup.mjs.map
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- export {};