From a22433ae05986a85452a405aa75d138e9b35660b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 10:40:41 +0100 Subject: [PATCH 1/9] Add `waitNextEventLoopTurnForUnhandledRejectionEvents` flag --- docs/CLI.md | 6 ++++++ e2e/promise-async-handling/package.json | 3 ++- .../jestAdapterInit.ts | 2 +- .../src/unhandledRejectionHandler.ts | 19 +++++++++++++------ packages/jest-cli/src/args.ts | 6 ++++++ packages/jest-config/src/Defaults.ts | 1 + packages/jest-config/src/ValidConfig.ts | 2 ++ packages/jest-config/src/index.ts | 2 ++ packages/jest-config/src/normalize.ts | 1 + packages/jest-types/src/Config.ts | 4 ++++ packages/test-utils/src/config.ts | 2 ++ 11 files changed, 40 insertions(+), 8 deletions(-) diff --git a/docs/CLI.md b/docs/CLI.md index c8cb41e6bf11..ed1a10e7b3fc 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -517,6 +517,12 @@ Display individual test results with the test suite hierarchy. Alias: `-v`. Print the version and exit. +### `--waitNextEventLoopTurnForUnhandledRejectionEvents` + +Gives one event loop turn to handle `rejectionHandled`, `uncaughtException` or `unhandledRejection`. + +Without this flag Jest may report false-positive errors (e.g. actually handled rejection reported) or not report actually unhandled rejection (or report it for different test case). + ### `--watch` Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option instead. diff --git a/e2e/promise-async-handling/package.json b/e2e/promise-async-handling/package.json index 148788b25446..ccb9cfbecab4 100644 --- a/e2e/promise-async-handling/package.json +++ b/e2e/promise-async-handling/package.json @@ -1,5 +1,6 @@ { "jest": { - "testEnvironment": "node" + "testEnvironment": "node", + "waitNextEventLoopTurnForUnhandledRejectionEvents": true } } diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts index e337c1477eea..d7aac566d3d8 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts @@ -132,7 +132,7 @@ export const initialize = async ({ addEventHandler(testCaseReportHandler(testPath, sendMessageToJest)); } - addEventHandler(unhandledRejectionHandler(runtime)); + addEventHandler(unhandledRejectionHandler(runtime, globalConfig.waitNextEventLoopTurnForUnhandledRejectionEvents)); // Return it back to the outer scope (test runner outside the VM). return {globals: globalsObject, snapshotState}; diff --git a/packages/jest-circus/src/unhandledRejectionHandler.ts b/packages/jest-circus/src/unhandledRejectionHandler.ts index 1902c2f2a5ee..fb6698d5a4d0 100644 --- a/packages/jest-circus/src/unhandledRejectionHandler.ts +++ b/packages/jest-circus/src/unhandledRejectionHandler.ts @@ -22,6 +22,7 @@ const untilNextEventLoopTurn = async () => { export const unhandledRejectionHandler = ( runtime: Runtime, + waitNextEventLoopTurnForUnhandledRejectionEvents: boolean, ): Circus.EventHandler => { return async (event, state) => { if (event.name === 'hook_start') { @@ -29,8 +30,10 @@ export const unhandledRejectionHandler = ( } else if (event.name === 'hook_success' || event.name === 'hook_failure') { runtime.leaveTestCode(); - // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events - await untilNextEventLoopTurn(); + if (waitNextEventLoopTurnForUnhandledRejectionEvents) { + // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events + await untilNextEventLoopTurn(); + } const {test, describeBlock, hook} = event; const {asyncError, type} = hook; @@ -60,8 +63,10 @@ export const unhandledRejectionHandler = ( ) { runtime.leaveTestCode(); - // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events - await untilNextEventLoopTurn(); + if (waitNextEventLoopTurnForUnhandledRejectionEvents) { + // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events + await untilNextEventLoopTurn(); + } const {test} = event; invariant(test, 'always present for `*Each` hooks'); @@ -70,8 +75,10 @@ export const unhandledRejectionHandler = ( test.errors.push([error, event.test.asyncError]); } } else if (event.name === 'teardown') { - // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events - await untilNextEventLoopTurn(); + if (waitNextEventLoopTurnForUnhandledRejectionEvents) { + // We need to give event loop the time to actually execute `rejectionHandled`, `uncaughtException` or `unhandledRejection` events + await untilNextEventLoopTurn(); + } state.unhandledErrors.push( ...state.unhandledRejectionErrorByPromise.values(), diff --git a/packages/jest-cli/src/args.ts b/packages/jest-cli/src/args.ts index 4f5b13d7c718..a99e5a7a16f1 100644 --- a/packages/jest-cli/src/args.ts +++ b/packages/jest-cli/src/args.ts @@ -686,6 +686,12 @@ export const options: {[key: string]: Options} = { 'Display individual test results with the test suite hierarchy.', type: 'boolean', }, + waitNextEventLoopTurnForUnhandledRejectionEvents: { + description: + 'Gives one event loop turn to handle `rejectionHandled`, ' + + '`uncaughtException` or `unhandledRejection`.', + type: 'boolean', + }, watch: { description: 'Watch files for changes and rerun tests related to ' + diff --git a/packages/jest-config/src/Defaults.ts b/packages/jest-config/src/Defaults.ts index 1684a51dbb5f..7ec03aa39273 100644 --- a/packages/jest-config/src/Defaults.ts +++ b/packages/jest-config/src/Defaults.ts @@ -91,6 +91,7 @@ const defaultOptions: Config.DefaultOptions = { testSequencer: '@jest/test-sequencer', transformIgnorePatterns: [NODE_MODULES_REGEXP, `\\.pnp\\.[^\\${sep}]+$`], useStderr: false, + waitNextEventLoopTurnForUnhandledRejectionEvents: false, watch: false, watchPathIgnorePatterns: [], watchman: true, diff --git a/packages/jest-config/src/ValidConfig.ts b/packages/jest-config/src/ValidConfig.ts index aac2cab36ee9..653492cd9c34 100644 --- a/packages/jest-config/src/ValidConfig.ts +++ b/packages/jest-config/src/ValidConfig.ts @@ -181,6 +181,7 @@ export const initialOptions: Config.InitialOptions = { updateSnapshot: true, useStderr: false, verbose: false, + waitNextEventLoopTurnForUnhandledRejectionEvents: false, watch: false, watchAll: false, watchPathIgnorePatterns: ['/e2e/'], @@ -320,6 +321,7 @@ export const initialProjectOptions: Config.InitialProjectOptions = { }, transformIgnorePatterns: [NODE_MODULES_REGEXP], unmockedModulePathPatterns: ['mock'], + waitNextEventLoopTurnForUnhandledRejectionEvents: false, watchPathIgnorePatterns: ['/e2e/'], workerIdleMemoryLimit: multipleValidOptions(0.2, '50%'), }; diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index 7be4d3708258..8ad6a0431dbf 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -138,6 +138,7 @@ const groupOptions = ( updateSnapshot: options.updateSnapshot, useStderr: options.useStderr, verbose: options.verbose, + waitNextEventLoopTurnForUnhandledRejectionEvents: options.waitNextEventLoopTurnForUnhandledRejectionEvents, watch: options.watch, watchAll: options.watchAll, watchPlugins: options.watchPlugins, @@ -203,6 +204,7 @@ const groupOptions = ( transform: options.transform, transformIgnorePatterns: options.transformIgnorePatterns, unmockedModulePathPatterns: options.unmockedModulePathPatterns, + waitNextEventLoopTurnForUnhandledRejectionEvents: options.waitNextEventLoopTurnForUnhandledRejectionEvents, watchPathIgnorePatterns: options.watchPathIgnorePatterns, }), }); diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 5a2d7fb51b9d..2fc58c74a2d7 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -933,6 +933,7 @@ export default async function normalize( case 'testNamePattern': case 'useStderr': case 'verbose': + case 'waitNextEventLoopTurnForUnhandledRejectionEvents': case 'watch': case 'watchAll': case 'watchman': diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 34afe821412e..bdd3881f2544 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -204,6 +204,7 @@ export type DefaultOptions = { testSequencer: string; transformIgnorePatterns: Array; useStderr: boolean; + waitNextEventLoopTurnForUnhandledRejectionEvents: boolean; watch: boolean; watchPathIgnorePatterns: Array; watchman: boolean; @@ -325,6 +326,7 @@ export type InitialOptions = Partial<{ updateSnapshot: boolean; useStderr: boolean; verbose?: boolean; + waitNextEventLoopTurnForUnhandledRejectionEvents: boolean; watch: boolean; watchAll: boolean; watchman: boolean; @@ -419,6 +421,7 @@ export type GlobalConfig = { updateSnapshot: SnapshotUpdateState; useStderr: boolean; verbose?: boolean; + waitNextEventLoopTurnForUnhandledRejectionEvents: boolean; watch: boolean; watchAll: boolean; watchman: boolean; @@ -491,6 +494,7 @@ export type ProjectConfig = { transformIgnorePatterns: Array; watchPathIgnorePatterns: Array; unmockedModulePathPatterns?: Array; + waitNextEventLoopTurnForUnhandledRejectionEvents: boolean; workerIdleMemoryLimit?: number; }; diff --git a/packages/test-utils/src/config.ts b/packages/test-utils/src/config.ts index 5aff9e0a15af..687ca12642da 100644 --- a/packages/test-utils/src/config.ts +++ b/packages/test-utils/src/config.ts @@ -62,6 +62,7 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = { updateSnapshot: 'none', useStderr: false, verbose: false, + waitNextEventLoopTurnForUnhandledRejectionEvents: false, watch: false, watchAll: false, watchPlugins: [], @@ -126,6 +127,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { transformIgnorePatterns: [], unmockedModulePathPatterns: undefined, watchPathIgnorePatterns: [], + waitNextEventLoopTurnForUnhandledRejectionEvents: false, }; export const makeGlobalConfig = ( From 83ee89d58e1a5251969fd060f437711ac5e89767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 10:46:49 +0100 Subject: [PATCH 2/9] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9491211f29d0..74b4db5fc5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Features +- `[jest-circus, jest-cli, jest-config]` Add `waitNextEventLoopTurnForUnhandledRejectionEvents` flag to minimise performance impact of correct detection of unhandled promise rejections introduced in [#14315](https://github.com/jestjs/jest/pull/) ([#14681](https://github.com/jestjs/jest/pull/14681)) - `[jest-config]` [**BREAKING**] Add `mts` and `cts` to default `moduleFileExtensions` config ([#14369](https://github.com/facebook/jest/pull/14369)) - `[jest-config]` [**BREAKING**] Update `testMatch` and `testRegex` default option for supporting `mjs`, `cjs`, `mts`, and `cts` ([#14584](https://github.com/jestjs/jest/pull/14584)) - `[@jest/core]` [**BREAKING**] Group together open handles with the same stack trace ([#13417](https://github.com/jestjs/jest/pull/13417), & [#14543](https://github.com/jestjs/jest/pull/14543)) From 5580cba4ea886593a853df5298a4a34f644ea2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 11:28:17 +0100 Subject: [PATCH 3/9] Fix ESLint errors --- .../src/legacy-code-todo-rewrite/jestAdapterInit.ts | 7 ++++++- packages/jest-config/src/index.ts | 6 ++++-- packages/test-utils/src/config.ts | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts index d7aac566d3d8..048cbad56b6f 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.ts @@ -132,7 +132,12 @@ export const initialize = async ({ addEventHandler(testCaseReportHandler(testPath, sendMessageToJest)); } - addEventHandler(unhandledRejectionHandler(runtime, globalConfig.waitNextEventLoopTurnForUnhandledRejectionEvents)); + addEventHandler( + unhandledRejectionHandler( + runtime, + globalConfig.waitNextEventLoopTurnForUnhandledRejectionEvents, + ), + ); // Return it back to the outer scope (test runner outside the VM). return {globals: globalsObject, snapshotState}; diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index 8ad6a0431dbf..93dd939283e0 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -138,7 +138,8 @@ const groupOptions = ( updateSnapshot: options.updateSnapshot, useStderr: options.useStderr, verbose: options.verbose, - waitNextEventLoopTurnForUnhandledRejectionEvents: options.waitNextEventLoopTurnForUnhandledRejectionEvents, + waitNextEventLoopTurnForUnhandledRejectionEvents: + options.waitNextEventLoopTurnForUnhandledRejectionEvents, watch: options.watch, watchAll: options.watchAll, watchPlugins: options.watchPlugins, @@ -204,7 +205,8 @@ const groupOptions = ( transform: options.transform, transformIgnorePatterns: options.transformIgnorePatterns, unmockedModulePathPatterns: options.unmockedModulePathPatterns, - waitNextEventLoopTurnForUnhandledRejectionEvents: options.waitNextEventLoopTurnForUnhandledRejectionEvents, + waitNextEventLoopTurnForUnhandledRejectionEvents: + options.waitNextEventLoopTurnForUnhandledRejectionEvents, watchPathIgnorePatterns: options.watchPathIgnorePatterns, }), }); diff --git a/packages/test-utils/src/config.ts b/packages/test-utils/src/config.ts index 687ca12642da..9686a3dca9f5 100644 --- a/packages/test-utils/src/config.ts +++ b/packages/test-utils/src/config.ts @@ -126,8 +126,8 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { transform: [], transformIgnorePatterns: [], unmockedModulePathPatterns: undefined, - watchPathIgnorePatterns: [], waitNextEventLoopTurnForUnhandledRejectionEvents: false, + watchPathIgnorePatterns: [], }; export const makeGlobalConfig = ( From 4a37a8749944960daff04c5bb5329fbc48c29f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 11:40:44 +0100 Subject: [PATCH 4/9] Update snapshots --- .../__snapshots__/showConfig.test.ts.snap | 2 ++ .../logDebugMessages.test.ts.snap | 4 +++- .../ScriptTransformer.test.ts.snap | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index d40875b9cab1..f07a2a7b8c17 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -91,6 +91,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` "/node_modules/", "<>" ], + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watchPathIgnorePatterns": [] } ], @@ -143,6 +144,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` "testSequencer": "<>/jest-test-sequencer/build/index.js", "updateSnapshot": "none", "useStderr": false, + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watch": false, "watchAll": false, "watchman": true, diff --git a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap index 0087fa7f5351..4177b70cd1a4 100644 --- a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap +++ b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap @@ -63,7 +63,8 @@ exports[`prints the config object 1`] = ` "testRunner": "myRunner", "transform": [], "transformIgnorePatterns": [], - "watchPathIgnorePatterns": [] + "watchPathIgnorePatterns": [], + "waitNextEventLoopTurnForUnhandledRejectionEvents": false }, "globalConfig": { "bail": 0, @@ -115,6 +116,7 @@ exports[`prints the config object 1`] = ` "updateSnapshot": "none", "useStderr": false, "verbose": false, + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watch": true, "watchAll": false, "watchPlugins": [], diff --git a/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap b/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap index 15e6e5e292c9..dc73996cf1a8 100644 --- a/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap +++ b/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap @@ -97,9 +97,10 @@ exports[`ScriptTransformer in async mode, passes expected transform options to g "/node_modules/", ], "unmockedModulePathPatterns": undefined, + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watchPathIgnorePatterns": Array [], }, - "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -125,7 +126,7 @@ exports[`ScriptTransformer in async mode, uses the supplied async preprocessor 1 "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -135,7 +136,7 @@ exports[`ScriptTransformer in async mode, uses the supplied preprocessor 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -235,9 +236,10 @@ exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] "/node_modules/", ], "unmockedModulePathPatterns": undefined, + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watchPathIgnorePatterns": Array [], }, - "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -347,9 +349,10 @@ exports[`ScriptTransformer passes expected transform options to getCacheKeyAsync "/node_modules/", ], "unmockedModulePathPatterns": undefined, + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, "watchPathIgnorePatterns": Array [], }, - "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -787,7 +790,7 @@ exports[`ScriptTransformer uses mixture of sync/async preprocessors 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -804,7 +807,7 @@ exports[`ScriptTransformer uses multiple preprocessors 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -821,7 +824,7 @@ exports[`ScriptTransformer uses the supplied preprocessor 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; From 2812a0d9d5b7ec01e9690eefe07ef1c3170a0856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 13:15:25 +0100 Subject: [PATCH 5/9] Fix failing tests --- .../environmentAfterTeardown.test.ts.snap | 2 +- ...vironmentAfterTeardownJasmine.test.ts.snap | 13 ----------- .../requireAfterTeardown.test.ts.snap | 2 +- .../requireAfterTeardownJasmine.test.ts.snap | 13 ----------- .../environmentAfterTeardown.test.ts | 9 +++----- .../environmentAfterTeardownJasmine.test.ts | 21 ------------------ e2e/__tests__/fakeTimersLegacy.test.ts | 6 +---- e2e/__tests__/requireAfterTeardown.test.ts | 7 ++---- .../requireAfterTeardownJasmine.test.ts | 22 ------------------- 9 files changed, 8 insertions(+), 87 deletions(-) delete mode 100644 e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap delete mode 100644 e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap delete mode 100644 e2e/__tests__/environmentAfterTeardownJasmine.test.ts delete mode 100644 e2e/__tests__/requireAfterTeardownJasmine.test.ts diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap index ced63eb48256..e851be178ae8 100644 --- a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prints useful error for environment methods after test is done 1`] = ` -" ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code. +"ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js. 9 | test('access environment methods after done', () => { 10 | setTimeout(() => { diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap deleted file mode 100644 index e851be178ae8..000000000000 --- a/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`prints useful error for environment methods after test is done 1`] = ` -"ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js. - - 9 | test('access environment methods after done', () => { - 10 | setTimeout(() => { - > 11 | jest.clearAllTimers(); - | ^ - 12 | }, 0); - 13 | }); - 14 |" -`; diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap index afa6ff3749e2..1a3d3fd9b988 100644 --- a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prints useful error for requires after test is done 1`] = ` -" ReferenceError: You are trying to \`import\` a file outside of the scope of the test code. +"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js. 9 | test('require after done', () => { 10 | setTimeout(() => { diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap deleted file mode 100644 index 1a3d3fd9b988..000000000000 --- a/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`prints useful error for requires after test is done 1`] = ` -"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js. - - 9 | test('require after done', () => { - 10 | setTimeout(() => { - > 11 | const double = require('../'); - | ^ - 12 | - 13 | expect(double(5)).toBe(10); - 14 | }, 0);" -`; diff --git a/e2e/__tests__/environmentAfterTeardown.test.ts b/e2e/__tests__/environmentAfterTeardown.test.ts index 7e71888b5ddb..1216014a2af4 100644 --- a/e2e/__tests__/environmentAfterTeardown.test.ts +++ b/e2e/__tests__/environmentAfterTeardown.test.ts @@ -5,17 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; -skipSuiteOnJasmine(); - test('prints useful error for environment methods after test is done', () => { const {stderr} = runJest('environment-after-teardown'); - const interestingLines = stderr.split('\n').slice(5, 14).join('\n'); + const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); expect(interestingLines).toMatchSnapshot(); - expect(stderr.split('\n')[5]).toMatch( - 'ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.', + expect(stderr.split('\n')[9]).toBe( + 'ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.', ); }); diff --git a/e2e/__tests__/environmentAfterTeardownJasmine.test.ts b/e2e/__tests__/environmentAfterTeardownJasmine.test.ts deleted file mode 100644 index 36e769478e0f..000000000000 --- a/e2e/__tests__/environmentAfterTeardownJasmine.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import {skipSuiteOnJestCircus} from '@jest/test-utils'; -import runJest from '../runJest'; - -skipSuiteOnJestCircus(); - -test('prints useful error for environment methods after test is done', () => { - const {stderr} = runJest('environment-after-teardown'); - const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); - - expect(interestingLines).toMatchSnapshot(); - expect(stderr.split('\n')[9]).toBe( - 'ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.', - ); -}); diff --git a/e2e/__tests__/fakeTimersLegacy.test.ts b/e2e/__tests__/fakeTimersLegacy.test.ts index 3ad3f3a7fb3f..268ce5aa80c2 100644 --- a/e2e/__tests__/fakeTimersLegacy.test.ts +++ b/e2e/__tests__/fakeTimersLegacy.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {isJestJasmineRun} from '@jest/test-utils'; import runJest from '../runJest'; describe('enableGlobally', () => { @@ -40,13 +39,10 @@ describe('requestAnimationFrame', () => { describe('setImmediate', () => { test('fakes setImmediate', () => { - // Jasmine runner does not handle unhandled promise rejections that are causing the test to fail in Jest circus - const expectedExitCode = isJestJasmineRun() ? 0 : 1; - const result = runJest('fake-timers-legacy/set-immediate'); expect(result.stderr).toMatch('setImmediate test'); - expect(result.exitCode).toBe(expectedExitCode); + expect(result.exitCode).toBe(0); }); }); diff --git a/e2e/__tests__/requireAfterTeardown.test.ts b/e2e/__tests__/requireAfterTeardown.test.ts index 764a593db864..0c306124f3d5 100644 --- a/e2e/__tests__/requireAfterTeardown.test.ts +++ b/e2e/__tests__/requireAfterTeardown.test.ts @@ -5,18 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; -skipSuiteOnJasmine(); - test('prints useful error for requires after test is done', () => { const {stderr} = runJest('require-after-teardown'); - const interestingLines = stderr.split('\n').slice(5, 14).join('\n'); + const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); expect(interestingLines).toMatchSnapshot(); - expect(stderr.split('\n')[16]).toMatch( + expect(stderr.split('\n')[19]).toMatch( '(__tests__/lateRequire.test.js:11:20)', ); }); diff --git a/e2e/__tests__/requireAfterTeardownJasmine.test.ts b/e2e/__tests__/requireAfterTeardownJasmine.test.ts deleted file mode 100644 index 3eeb390ad8ea..000000000000 --- a/e2e/__tests__/requireAfterTeardownJasmine.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import {skipSuiteOnJestCircus} from '@jest/test-utils'; -import runJest from '../runJest'; - -skipSuiteOnJestCircus(); - -test('prints useful error for requires after test is done', () => { - const {stderr} = runJest('require-after-teardown'); - - const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); - - expect(interestingLines).toMatchSnapshot(); - expect(stderr.split('\n')[19]).toMatch( - '(__tests__/lateRequire.test.js:11:20)', - ); -}); From 430d0782e88b70cb9a8193bbd80ecf61d6faca1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 14:01:55 +0100 Subject: [PATCH 6/9] Update documentation --- docs/CLI.md | 2 ++ docs/Configuration.md | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/CLI.md b/docs/CLI.md index ed1a10e7b3fc..e092a9e65332 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -523,6 +523,8 @@ Gives one event loop turn to handle `rejectionHandled`, `uncaughtException` or ` Without this flag Jest may report false-positive errors (e.g. actually handled rejection reported) or not report actually unhandled rejection (or report it for different test case). +This option may add a noticeable overhead for fast test suites. + ### `--watch` Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option instead. diff --git a/docs/Configuration.md b/docs/Configuration.md index d557dcee7904..c9a7c55fe38f 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -2358,6 +2358,14 @@ Default: `false` or `true` if there is only one test file to run Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution. +### `waitNextEventLoopTurnForUnhandledRejectionEvents` \[boolean] + +Gives one event loop turn to handle `rejectionHandled`, `uncaughtException` or `unhandledRejection`. + +Without this flag Jest may report false-positive errors (e.g. actually handled rejection reported) or not report actually unhandled rejection (or report it for different test case). + +This option may add a noticeable overhead for fast test suites. + ### `watchPathIgnorePatterns` \[array<string>] Default: `[]` From 3ef34935878ebc7065cafc1dd83a7bcc1603b2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 14:02:35 +0100 Subject: [PATCH 7/9] Fix link in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74b4db5fc5b3..6751df89dd51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Features -- `[jest-circus, jest-cli, jest-config]` Add `waitNextEventLoopTurnForUnhandledRejectionEvents` flag to minimise performance impact of correct detection of unhandled promise rejections introduced in [#14315](https://github.com/jestjs/jest/pull/) ([#14681](https://github.com/jestjs/jest/pull/14681)) +- `[jest-circus, jest-cli, jest-config]` Add `waitNextEventLoopTurnForUnhandledRejectionEvents` flag to minimise performance impact of correct detection of unhandled promise rejections introduced in [#14315](https://github.com/jestjs/jest/pull/14315) ([#14681](https://github.com/jestjs/jest/pull/14681)) - `[jest-config]` [**BREAKING**] Add `mts` and `cts` to default `moduleFileExtensions` config ([#14369](https://github.com/facebook/jest/pull/14369)) - `[jest-config]` [**BREAKING**] Update `testMatch` and `testRegex` default option for supporting `mjs`, `cjs`, `mts`, and `cts` ([#14584](https://github.com/jestjs/jest/pull/14584)) - `[@jest/core]` [**BREAKING**] Group together open handles with the same stack trace ([#13417](https://github.com/jestjs/jest/pull/13417), & [#14543](https://github.com/jestjs/jest/pull/14543)) From d5ade2d2900e38cbe61cebcee3c591f8b8744921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 14:28:30 +0100 Subject: [PATCH 8/9] Update snapshots --- .../__snapshots__/logDebugMessages.test.ts.snap | 4 ++-- .../__snapshots__/ScriptTransformer.test.ts.snap | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap index 4177b70cd1a4..50fbf35d26b6 100644 --- a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap +++ b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap @@ -63,8 +63,8 @@ exports[`prints the config object 1`] = ` "testRunner": "myRunner", "transform": [], "transformIgnorePatterns": [], - "watchPathIgnorePatterns": [], - "waitNextEventLoopTurnForUnhandledRejectionEvents": false + "waitNextEventLoopTurnForUnhandledRejectionEvents": false, + "watchPathIgnorePatterns": [] }, "globalConfig": { "bail": 0, diff --git a/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap b/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap index dc73996cf1a8..e261ab8b2c47 100644 --- a/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap +++ b/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap @@ -126,7 +126,7 @@ exports[`ScriptTransformer in async mode, uses the supplied async preprocessor 1 "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -136,7 +136,7 @@ exports[`ScriptTransformer in async mode, uses the supplied preprocessor 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -790,7 +790,7 @@ exports[`ScriptTransformer uses mixture of sync/async preprocessors 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_async_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -807,7 +807,7 @@ exports[`ScriptTransformer uses multiple preprocessors 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; @@ -824,7 +824,7 @@ exports[`ScriptTransformer uses the supplied preprocessor 1`] = ` "const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[],"waitNextEventLoopTurnForUnhandledRejectionEvents":false},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', + config: '{"collectCoverage":false,"collectCoverageFrom":[],"coverageProvider":"babel","supportsDynamicImport":false,"supportsExportNamespaceFrom":false,"supportsStaticESM":false,"supportsTopLevelAwait":false,"instrument":false,"cacheFS":{},"config":{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"collectCoverageFrom":["src","!public"],"coverageDirectory":"coverage","coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"fakeTimers":{"enableGlobally":false},"forceCoverageMatch":[],"globals":{},"haste":{},"id":"test","injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"openHandlesTimeout":1000,"prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","runtime":"/test_module_loader_path","sandboxInjectedGlobals":[],"setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"waitNextEventLoopTurnForUnhandledRejectionEvents":false,"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"collectCoverageFrom\\":[\\"src\\",\\"!public\\"],\\"coverageDirectory\\":\\"coverage\\",\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"fakeTimers\\":{\\"enableGlobally\\":false},\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"id\\":\\"test\\",\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"openHandlesTimeout\\":1000,\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"runtime\\":\\"/test_module_loader_path\\",\\"sandboxInjectedGlobals\\":[],\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"waitNextEventLoopTurnForUnhandledRejectionEvents\\":false,\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', };" `; From 2cfa23f42467268d825d1766e70f1287ff121525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20S=CC=8Ctekl?= Date: Mon, 6 Nov 2023 14:56:54 +0100 Subject: [PATCH 9/9] Put back useful tests --- .../environmentAfterTeardown.test.ts.snap | 14 +++++++++- ...vironmentAfterTeardownJasmine.test.ts.snap | 25 +++++++++++++++++ .../requireAfterTeardown.test.ts.snap | 14 +++++++++- .../requireAfterTeardownJasmine.test.ts.snap | 25 +++++++++++++++++ .../environmentAfterTeardown.test.ts | 17 ++++++++++- .../environmentAfterTeardownJasmine.test.ts | 28 +++++++++++++++++++ e2e/__tests__/fakeTimersLegacy.test.ts | 15 +++++++++- e2e/__tests__/requireAfterTeardown.test.ts | 18 +++++++++++- .../requireAfterTeardownJasmine.test.ts | 26 +++++++++++++++++ 9 files changed, 177 insertions(+), 5 deletions(-) create mode 100644 e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap create mode 100644 e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap create mode 100644 e2e/__tests__/environmentAfterTeardownJasmine.test.ts create mode 100644 e2e/__tests__/requireAfterTeardownJasmine.test.ts diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap index e851be178ae8..fe7a08d98855 100644 --- a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap @@ -1,6 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`prints useful error for environment methods after test is done 1`] = ` +exports[`prints useful error for environment methods after test is done w/ \`waitNextEventLoopTurnForUnhandledRejectionEvents\` 1`] = ` +" ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code. + + 9 | test('access environment methods after done', () => { + 10 | setTimeout(() => { + > 11 | jest.clearAllTimers(); + | ^ + 12 | }, 0); + 13 | }); + 14 |" +`; + +exports[`prints useful error for environment methods after test is done w/o \`waitNextEventLoopTurnForUnhandledRejectionEvents\` 1`] = ` "ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js. 9 | test('access environment methods after done', () => { diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap new file mode 100644 index 000000000000..0a81f1daa50f --- /dev/null +++ b/e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`prints useful error for environment methods after test is done 1`] = ` +"ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js. + + 9 | test('access environment methods after done', () => { + 10 | setTimeout(() => { + > 11 | jest.clearAllTimers(); + | ^ + 12 | }, 0); + 13 | }); + 14 |" +`; + +exports[`prints useful error for environment methods after test is done 2`] = ` +"ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js. + + 9 | test('access environment methods after done', () => { + 10 | setTimeout(() => { + > 11 | jest.clearAllTimers(); + | ^ + 12 | }, 0); + 13 | }); + 14 |" +`; diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap index 1a3d3fd9b988..d15deff33f65 100644 --- a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap @@ -1,6 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`prints useful error for requires after test is done 1`] = ` +exports[`prints useful error for requires after test is done w/ \`waitNextEventLoopTurnForUnhandledRejectionEvents\` 1`] = ` +" ReferenceError: You are trying to \`import\` a file outside of the scope of the test code. + + 9 | test('require after done', () => { + 10 | setTimeout(() => { + > 11 | const double = require('../'); + | ^ + 12 | + 13 | expect(double(5)).toBe(10); + 14 | }, 0);" +`; + +exports[`prints useful error for requires after test is done w/o \`waitNextEventLoopTurnForUnhandledRejectionEvents\` 1`] = ` "ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js. 9 | test('require after done', () => { diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap new file mode 100644 index 000000000000..89e353825249 --- /dev/null +++ b/e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`prints useful error for requires after test is done 1`] = ` +"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js. + + 9 | test('require after done', () => { + 10 | setTimeout(() => { + > 11 | const double = require('../'); + | ^ + 12 | + 13 | expect(double(5)).toBe(10); + 14 | }, 0);" +`; + +exports[`prints useful error for requires after test is done 2`] = ` +"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js. + + 9 | test('require after done', () => { + 10 | setTimeout(() => { + > 11 | const double = require('../'); + | ^ + 12 | + 13 | expect(double(5)).toBe(10); + 14 | }, 0);" +`; diff --git a/e2e/__tests__/environmentAfterTeardown.test.ts b/e2e/__tests__/environmentAfterTeardown.test.ts index 1216014a2af4..aaa12c116791 100644 --- a/e2e/__tests__/environmentAfterTeardown.test.ts +++ b/e2e/__tests__/environmentAfterTeardown.test.ts @@ -5,9 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; -test('prints useful error for environment methods after test is done', () => { +skipSuiteOnJasmine(); + +test('prints useful error for environment methods after test is done w/o `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { const {stderr} = runJest('environment-after-teardown'); const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); @@ -16,3 +19,15 @@ test('prints useful error for environment methods after test is done', () => { 'ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.', ); }); + +test('prints useful error for environment methods after test is done w/ `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { + const {stderr} = runJest('environment-after-teardown', [ + '--waitNextEventLoopTurnForUnhandledRejectionEvents', + ]); + const interestingLines = stderr.split('\n').slice(5, 14).join('\n'); + + expect(interestingLines).toMatchSnapshot(); + expect(stderr.split('\n')[5]).toMatch( + 'ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.', + ); +}); diff --git a/e2e/__tests__/environmentAfterTeardownJasmine.test.ts b/e2e/__tests__/environmentAfterTeardownJasmine.test.ts new file mode 100644 index 000000000000..d72d8497c3fd --- /dev/null +++ b/e2e/__tests__/environmentAfterTeardownJasmine.test.ts @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {skipSuiteOnJestCircus} from '@jest/test-utils'; +import runJest from '../runJest'; + +skipSuiteOnJestCircus(); + +test.each` + jestArgs + ${[]} + ${['--waitNextEventLoopTurnForUnhandledRejectionEvents']} +`( + 'prints useful error for environment methods after test is done', + ({jestArgs}) => { + const {stderr} = runJest('environment-after-teardown', jestArgs); + const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); + + expect(interestingLines).toMatchSnapshot(); + expect(stderr.split('\n')[9]).toBe( + 'ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.', + ); + }, +); diff --git a/e2e/__tests__/fakeTimersLegacy.test.ts b/e2e/__tests__/fakeTimersLegacy.test.ts index 268ce5aa80c2..2c28a1da4f78 100644 --- a/e2e/__tests__/fakeTimersLegacy.test.ts +++ b/e2e/__tests__/fakeTimersLegacy.test.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import {isJestJasmineRun} from '@jest/test-utils'; import runJest from '../runJest'; describe('enableGlobally', () => { @@ -38,12 +39,24 @@ describe('requestAnimationFrame', () => { }); describe('setImmediate', () => { - test('fakes setImmediate', () => { + test('fakes setImmediate w/o `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { const result = runJest('fake-timers-legacy/set-immediate'); expect(result.stderr).toMatch('setImmediate test'); expect(result.exitCode).toBe(0); }); + + test('fakes setImmediate w/ `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { + // Jasmine runner does not handle unhandled promise rejections that are causing the test to fail in Jest circus + const expectedExitCode = isJestJasmineRun() ? 0 : 1; + + const result = runJest('fake-timers-legacy/set-immediate', [ + '--waitNextEventLoopTurnForUnhandledRejectionEvents', + ]); + + expect(result.stderr).toMatch('setImmediate test'); + expect(result.exitCode).toBe(expectedExitCode); + }); }); describe('useRealTimers', () => { diff --git a/e2e/__tests__/requireAfterTeardown.test.ts b/e2e/__tests__/requireAfterTeardown.test.ts index 0c306124f3d5..76ff2d2291c2 100644 --- a/e2e/__tests__/requireAfterTeardown.test.ts +++ b/e2e/__tests__/requireAfterTeardown.test.ts @@ -5,9 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import {skipSuiteOnJasmine} from '@jest/test-utils'; import runJest from '../runJest'; -test('prints useful error for requires after test is done', () => { +skipSuiteOnJasmine(); + +test('prints useful error for requires after test is done w/o `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { const {stderr} = runJest('require-after-teardown'); const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); @@ -17,3 +20,16 @@ test('prints useful error for requires after test is done', () => { '(__tests__/lateRequire.test.js:11:20)', ); }); + +test('prints useful error for requires after test is done w/ `waitNextEventLoopTurnForUnhandledRejectionEvents`', () => { + const {stderr} = runJest('require-after-teardown', [ + '--waitNextEventLoopTurnForUnhandledRejectionEvents', + ]); + + const interestingLines = stderr.split('\n').slice(5, 14).join('\n'); + + expect(interestingLines).toMatchSnapshot(); + expect(stderr.split('\n')[16]).toMatch( + '(__tests__/lateRequire.test.js:11:20)', + ); +}); diff --git a/e2e/__tests__/requireAfterTeardownJasmine.test.ts b/e2e/__tests__/requireAfterTeardownJasmine.test.ts new file mode 100644 index 000000000000..9a0360ba8c2d --- /dev/null +++ b/e2e/__tests__/requireAfterTeardownJasmine.test.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {skipSuiteOnJestCircus} from '@jest/test-utils'; +import runJest from '../runJest'; + +skipSuiteOnJestCircus(); + +test.each` + jestArgs + ${[]} + ${['--waitNextEventLoopTurnForUnhandledRejectionEvents']} +`('prints useful error for requires after test is done', ({jestArgs}) => { + const {stderr} = runJest('require-after-teardown', jestArgs); + + const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); + + expect(interestingLines).toMatchSnapshot(); + expect(stderr.split('\n')[19]).toMatch( + '(__tests__/lateRequire.test.js:11:20)', + ); +});