Simen Bekkhus
Simen Bekkhus
For 1& 2, we could probably read en environment variable to work around it. I wonder if a scalable (long term) solution would be to allow reporters to inject some...
Solving the underlying issue with serialization would be highly preferable!
This smells like a missing `await` somewhere 🤔 That said, I've run the provided reproduction command 10 times in a row without seeing a failure 😅
Would it help if we did the `Object.keys` and `Object.entries` at the same time at the top rather than doing the `entries` one lazily? e.g. ```ts const allExports = Object.entries(required);...
Hmm, `source-map-support` does indeed add `process.emit` like you say: https://github.com/evanw/node-source-map-support/blob/7b5b81eb14c9ee6c6537398262bf7dab8580621c/source-map-support.js#L602-L612 Seems there's a flag we can pass to have it not do such weird things. We already do, tho: https://github.com/jestjs/jest/blob/559449e5a0a87210324720b56caa55b2e0ad3c94/packages/jest-runner/src/runTest.ts#L235
@danfuzz how can I run jest in your repository without going via your script? I wanna try debugging, but the layers of bash scripts is a bit much for me...
Great you figured it out! > * It's still the case that modifying a Node core module in the middle of a test can mess the Jest runner up, and...
If anybody comes to this issue for the "good first issue" label - this is what we want: https://github.com/jestjs/jest/issues/15077#issuecomment-2122676289 Code is in https://github.com/jestjs/jest/blob/559449e5a0a87210324720b56caa55b2e0ad3c94/packages/jest-runtime/src/index.ts#L1774-L1786
You mentioned JSON files in the other PR. This is how we construct them in ESM mode: https://github.com/jestjs/jest/blob/00ef0ed0a03764f24ff568bc87dcc1c203d28625/packages/jest-runtime/src/index.ts#L492-L500 Essentially copied straight from the docs (which use a JSON example): https://nodejs.org/api/vm.html#class-vmsyntheticmodule...
@Havunen this does not reproduce if I remove the `importModuleDynamically` option from `createScriptFromCode` in `jest-runtime`. So I'm guessing it's still related to the broken code caching (i.e. nr 4 here...