@emarketeer/ts-microservice-commons 8.2.0 → 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.
- package/dist/lib/jest.config.js +15 -0
- package/package.json +1 -1
package/dist/lib/jest.config.js
CHANGED
|
@@ -51,6 +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
|
+
// 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'
|
|
54
69
|
}
|
|
55
70
|
var shouldAddSetup = !process.argv.includes('unit');
|
|
56
71
|
if (shouldAddSetup) {
|