From f2f578f3337b6d63b0303e6a70f3c011b1d97eea Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sat, 5 Feb 2022 18:27:32 +0100 Subject: [PATCH] chore: do not escape strings in snapshots (#12303) --- .../asyncAndCallback.test.ts.snap | 4 +- .../__snapshots__/beforeAllFiltered.ts.snap | 4 +- .../__snapshots__/beforeEachQueue.ts.snap | 4 +- .../__snapshots__/callDoneTwice.test.ts.snap | 4 +- .../chaiAssertionLibrary.ts.snap | 4 +- .../circularInequality.test.ts.snap | 8 +- .../circusDeclarationErrors.test.ts.snap | 4 +- .../cliHandlesExactFilenames.test.ts.snap | 8 +- .../__snapshots__/console.test.ts.snap | 72 +++++----- .../consoleAfterTeardown.test.ts.snap | 4 +- .../consoleDebugging.test.ts.snap | 12 +- ...consoleLogOutputWhenRunInBand.test.ts.snap | 12 +- .../coverageHandlebars.test.ts.snap | 4 +- .../coverageProviderV8.test.ts.snap | 24 ++-- .../__snapshots__/coverageReport.test.ts.snap | 42 +++--- .../coverageThreshold.test.ts.snap | 52 +++---- .../coverageWithoutTransform.test.ts.snap | 4 +- .../customInlineSnapshotMatchers.test.ts.snap | 8 +- .../customMatcherStackTrace.test.ts.snap | 8 +- .../customReporters.test.ts.snap | 24 ++-- .../declarationErrors.test.ts.snap | 8 +- .../__snapshots__/detectOpenHandles.ts.snap | 24 ++-- .../__snapshots__/domDiffing.test.ts.snap | 2 +- e2e/__tests__/__snapshots__/each.test.ts.snap | 24 ++-- .../environmentAfterTeardown.test.ts.snap | 4 +- .../errorOnDeprecated.test.ts.snap | 48 +++---- .../executeTestsOnceInMpr.ts.snap | 4 +- .../expectAsyncMatcher.test.ts.snap | 4 +- .../__snapshots__/failures.test.ts.snap | 44 +++--- .../findRelatedFiles.test.ts.snap | 36 ++--- .../__snapshots__/globals.test.ts.snap | 80 +++++------ .../__snapshots__/injectGlobals.test.ts.snap | 16 +-- .../__snapshots__/jest.config.js.test.ts.snap | 20 +-- .../__snapshots__/jest.config.ts.test.ts.snap | 28 ++-- .../__snapshots__/listTests.test.ts.snap | 6 +- .../moduleNameMapper.test.ts.snap | 16 +-- .../multiProjectRunner.test.ts.snap | 20 +-- .../__snapshots__/multipleConfigs.ts.snap | 8 +- .../__snapshots__/nativeEsm.test.ts.snap | 8 +- .../nestedTestDefinitions.test.ts.snap | 8 +- .../__snapshots__/processExit.test.ts.snap | 4 +- .../requireAfterTeardown.test.ts.snap | 4 +- .../resolveNoFileExtensions.test.ts.snap | 8 +- ...grammaticallyMultipleProjects.test.ts.snap | 4 +- .../__snapshots__/showConfig.test.ts.snap | 4 +- .../__snapshots__/snapshot.test.ts.snap | 68 ++++----- .../__snapshots__/snapshotMockFs.test.ts.snap | 4 +- .../snapshotSerializers.test.ts.snap | 14 +- .../__snapshots__/stackTrace.test.ts.snap | 28 ++-- ...ckTraceSourceMapsWithCoverage.test.ts.snap | 4 +- .../testEnvironmentRunScript.test.ts.snap | 2 +- .../testNamePattern.test.ts.snap | 4 +- .../testNamePatternSkipped.test.ts.snap | 4 +- .../__snapshots__/testTodo.test.ts.snap | 20 +-- .../__snapshots__/timeouts.test.ts.snap | 24 ++-- .../__snapshots__/timeoutsLegacy.test.ts.snap | 16 +-- .../toMatchInlineSnapshot.test.ts.snap | 84 +++++------ ...owErrorMatchingInlineSnapshot.test.ts.snap | 12 +- .../toThrowErrorMatchingSnapshot.test.ts.snap | 4 +- .../__snapshots__/transform.test.ts.snap | 20 +-- .../typescriptCoverage.test.ts.snap | 4 +- .../watchModeOnlyFailed.test.ts.snap | 16 +-- .../watchModePatterns.test.ts.snap | 32 ++--- .../watchModeUpdateSnapshot.test.ts.snap | 16 +-- .../__snapshots__/wrongEnv.test.ts.snap | 20 +-- e2e/__tests__/asyncAndCallback.test.ts | 3 +- e2e/__tests__/beforeAllFiltered.ts | 3 +- e2e/__tests__/beforeEachQueue.ts | 3 +- e2e/__tests__/callDoneTwice.test.ts | 4 +- e2e/__tests__/chaiAssertionLibrary.ts | 3 +- e2e/__tests__/circularInequality.test.ts | 5 +- e2e/__tests__/circusDeclarationErrors.test.ts | 3 +- .../cliHandlesExactFilenames.test.ts | 5 +- e2e/__tests__/console.test.ts | 41 +++--- e2e/__tests__/consoleAfterTeardown.test.ts | 3 +- e2e/__tests__/consoleDebugging.test.ts | 7 +- .../consoleLogOutputWhenRunInBand.test.ts | 7 +- e2e/__tests__/coverageHandlebars.test.ts | 3 +- e2e/__tests__/coverageProviderV8.test.ts | 13 +- e2e/__tests__/coverageReport.test.ts | 23 ++- e2e/__tests__/coverageThreshold.test.ts | 27 ++-- .../coverageWithoutTransform.test.ts | 3 +- e2e/__tests__/crawlSymlinks.test.ts | 7 +- .../customInlineSnapshotMatchers.test.ts | 5 +- e2e/__tests__/customMatcherStackTrace.test.ts | 5 +- e2e/__tests__/customReporters.test.ts | 13 +- e2e/__tests__/declarationErrors.test.ts | 23 ++- e2e/__tests__/detectOpenHandles.ts | 15 +- e2e/__tests__/each.test.ts | 13 +- .../environmentAfterTeardown.test.ts | 3 +- e2e/__tests__/errorOnDeprecated.test.ts | 3 +- e2e/__tests__/executeTestsOnceInMpr.ts | 3 +- e2e/__tests__/expectAsyncMatcher.test.ts | 3 +- e2e/__tests__/failureDetailsProperty.test.ts | 40 +++--- e2e/__tests__/failures.test.ts | 23 ++- e2e/__tests__/findRelatedFiles.test.ts | 39 +++--- e2e/__tests__/globals.test.ts | 41 +++--- e2e/__tests__/injectGlobals.test.ts | 5 +- e2e/__tests__/jest.config.js.test.ts | 13 +- e2e/__tests__/jest.config.ts.test.ts | 17 +-- e2e/__tests__/listTests.test.ts | 5 +- e2e/__tests__/moduleNameMapper.test.ts | 9 +- e2e/__tests__/multiProjectRunner.test.ts | 11 +- e2e/__tests__/multipleConfigs.ts | 5 +- e2e/__tests__/nativeEsm.test.ts | 5 +- e2e/__tests__/nestedTestDefinitions.test.ts | 19 ++- e2e/__tests__/processExit.test.ts | 3 +- e2e/__tests__/requireAfterTeardown.test.ts | 3 +- e2e/__tests__/resolveNoFileExtensions.test.ts | 5 +- ...unProgrammaticallyMultipleProjects.test.ts | 3 +- e2e/__tests__/showConfig.test.ts | 3 +- e2e/__tests__/snapshot.test.ts | 35 +++-- e2e/__tests__/snapshotMockFs.test.ts | 3 +- e2e/__tests__/stackTrace.test.ts | 15 +- .../stackTraceSourceMapsWithCoverage.test.ts | 3 +- e2e/__tests__/testNamePattern.test.ts | 3 +- e2e/__tests__/testNamePatternSkipped.test.ts | 3 +- e2e/__tests__/testTodo.test.ts | 11 +- e2e/__tests__/timeouts.test.ts | 13 +- e2e/__tests__/timeoutsLegacy.test.ts | 9 +- e2e/__tests__/toMatchInlineSnapshot.test.ts | 45 +++--- ...toThrowErrorMatchingInlineSnapshot.test.ts | 7 +- .../toThrowErrorMatchingSnapshot.test.ts | 3 +- e2e/__tests__/transform.test.ts | 11 +- e2e/__tests__/typescriptCoverage.test.ts | 3 +- e2e/__tests__/watchModeOnlyFailed.test.ts | 7 +- e2e/__tests__/watchModePatterns.test.ts | 13 +- e2e/__tests__/watchModeUpdateSnapshot.test.ts | 7 +- e2e/__tests__/wrongEnv.test.ts | 3 +- jest.config.js | 5 +- package.json | 1 - packages/jest-circus/package.json | 3 +- .../__snapshots__/afterAll.test.ts.snap | 20 +-- .../__snapshots__/baseTest.test.ts.snap | 8 +- .../__snapshots__/hooks.test.ts.snap | 12 +- .../src/__tests__/afterAll.test.ts | 11 +- .../src/__tests__/baseTest.test.ts | 5 +- .../jest-circus/src/__tests__/hooks.test.ts | 7 +- .../__tests__/__snapshots__/init.test.js.snap | 64 ++++----- .../modifyPackageJson.test.ts.snap | 14 +- packages/jest-config/package.json | 1 - .../__snapshots__/normalize.test.ts.snap | 72 +++++----- .../src/__tests__/normalize.test.ts | 9 +- packages/jest-core/package.json | 3 +- .../__snapshots__/watch.test.js.snap | 2 +- .../watchFilenamePatternMode.test.js.snap | 32 ++--- .../watchTestNamePatternMode.test.js.snap | 36 ++--- .../watchFilenamePatternMode.test.js | 3 +- .../watchTestNamePatternMode.test.js | 3 +- .../logDebugMessages.test.ts.snap | 4 +- .../lib/__tests__/logDebugMessages.test.ts | 3 +- .../__snapshots__/template.test.ts.snap | 132 +++++++++--------- packages/jest-fake-timers/package.json | 3 +- .../legacyFakeTimers.test.ts.snap | 4 +- .../modernFakeTimers.test.ts.snap | 2 +- .../src/__tests__/legacyFakeTimers.test.ts | 3 +- packages/jest-haste-map/package.json | 1 - .../__snapshots__/index.test.js.snap | 20 +-- .../src/__tests__/index.test.js | 11 +- .../expectationResultFactory.test.ts.snap | 2 +- .../__snapshots__/index.test.ts.snap | 2 +- .../__snapshots__/messages.test.ts.snap | 16 +-- packages/jest-runtime/package.json | 3 +- .../__snapshots__/runtime_wrap.js.snap | 8 +- .../src/__tests__/runtime_wrap.js | 5 +- packages/jest-transform/package.json | 3 +- .../src/__tests__/ScriptTransformer.test.ts | 39 +++--- .../ScriptTransformer.test.ts.snap | 108 +++++++------- .../__snapshots__/validate.test.ts.snap | 56 ++++---- .../validateCLIOptions.test.js.snap | 8 +- .../__snapshots__/react.test.tsx.snap | 4 +- yarn.lock | 25 +--- 172 files changed, 1243 insertions(+), 1356 deletions(-) diff --git a/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap b/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap index 6660d59310cc..5fbda79530a2 100644 --- a/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap +++ b/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`errors when a test both returns a promise and takes a callback 1`] = ` -FAIL __tests__/promise-and-callback.test.js +"FAIL __tests__/promise-and-callback.test.js ✕ promise-returning test with callback ✕ async test with callback ✕ test done before return value @@ -49,5 +49,5 @@ FAIL __tests__/promise-and-callback.test.js 22 | 23 | return 'foobar'; - at Object.it (__tests__/promise-and-callback.test.js:20:1) + at Object.it (__tests__/promise-and-callback.test.js:20:1)" `; diff --git a/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap b/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap index 77cb833acb56..f77440c7da5c 100644 --- a/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap +++ b/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Correct BeforeAll run ensures the BeforeAll of ignored suite is not run 1`] = ` - console.log +" console.log beforeAll 1 at log (__tests__/beforeAllFiltered.test.js:10:13) @@ -25,5 +25,5 @@ exports[`Correct BeforeAll run ensures the BeforeAll of ignored suite is not run afterAll 1 at log (__tests__/beforeAllFiltered.test.js:19:13) - +" `; diff --git a/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap b/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap index 4acca9e4a59d..a5efe65c502d 100644 --- a/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap +++ b/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] = ` - console.log +" console.log BeforeEach at Object.log (__tests__/beforeEachQueue.test.js:10:13) @@ -25,5 +25,5 @@ exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] = It Bar at Object.log (__tests__/beforeEachQueue.test.js:22:13) - +" `; diff --git a/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap b/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap index 48fc34812088..459489e00ee5 100644 --- a/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap +++ b/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`\`done()\` should not be called more than once 1`] = ` -FAIL __tests__/index.test.js +"FAIL __tests__/index.test.js ● \`done()\` called more than once › should fail Expected done to be called once, but it was called multiple times. @@ -85,5 +85,5 @@ FAIL __tests__/index.test.js 61 | 62 | it('should fail', () => { - at done (__tests__/index.test.js:59:5) + at done (__tests__/index.test.js:59:5)" `; diff --git a/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap b/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap index b743187d01ba..922938b4a50d 100644 --- a/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap +++ b/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`chai assertion errors should display properly 1`] = ` -FAIL __tests__/chai_assertion.js +"FAIL __tests__/chai_assertion.js ● chai.js assertion library test › expect assert.strictEqual(received, expected) @@ -90,5 +90,5 @@ FAIL __tests__/chai_assertion.js 26 | }); 27 | - at Object.strictEqual (__tests__/chai_assertion.js:24:17) + at Object.strictEqual (__tests__/chai_assertion.js:24:17)" `; diff --git a/e2e/__tests__/__snapshots__/circularInequality.test.ts.snap b/e2e/__tests__/__snapshots__/circularInequality.test.ts.snap index c37d9f2edacf..7922a6da5ced 100644 --- a/e2e/__tests__/__snapshots__/circularInequality.test.ts.snap +++ b/e2e/__tests__/__snapshots__/circularInequality.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`handles circular inequality properly 1`] = ` -FAIL __tests__/test-1.js +"FAIL __tests__/test-1.js ● test expect(received).toEqual(expected) // deep equality @@ -41,13 +41,13 @@ FAIL __tests__/test-2.js | ^ 6 | }); - at Object.toEqual (__tests__/test-2.js:5:15) + at Object.toEqual (__tests__/test-2.js:5:15)" `; exports[`handles circular inequality properly 2`] = ` -Test Suites: 2 failed, 2 total +"Test Suites: 2 failed, 2 total Tests: 2 failed, 2 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap b/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap index 36c675798378..b7287b434772 100644 --- a/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap +++ b/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`defining tests and hooks asynchronously throws 1`] = ` -FAIL __tests__/asyncDefinition.test.js +"FAIL __tests__/asyncDefinition.test.js ● Test suite failed to run @@ -61,5 +61,5 @@ FAIL __tests__/asyncDefinition.test.js 21 | at eventHandler (../../packages/jest-circus/build/eventHandler.js:158:11) - at afterAll (__tests__/asyncDefinition.test.js:19:3) + at afterAll (__tests__/asyncDefinition.test.js:19:3)" `; diff --git a/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap b/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap index 1b384c13fd20..4eb172dc686b 100644 --- a/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap +++ b/e2e/__tests__/__snapshots__/cliHandlesExactFilenames.test.ts.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CLI accepts exact file names if matchers matched 1`] = ` -PASS foo/bar.spec.js +"PASS foo/bar.spec.js ✓ foo -Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished? +Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?" `; exports[`CLI accepts exact file names if matchers matched 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /.\\/foo\\/bar.spec.js/i. +Ran all test suites matching /.\\/foo\\/bar.spec.js/i." `; diff --git a/e2e/__tests__/__snapshots__/console.test.ts.snap b/e2e/__tests__/__snapshots__/console.test.ts.snap index 6af62c8466c4..849933bd86c4 100644 --- a/e2e/__tests__/__snapshots__/console.test.ts.snap +++ b/e2e/__tests__/__snapshots__/console.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`console printing 1`] = ` -PASS __tests__/console.test.js +"PASS __tests__/console.test.js ● Console console.log @@ -37,19 +37,19 @@ PASS __tests__/console.test.js 17 | }); 18 | - at Object.error (__tests__/console.test.js:16:11) + at Object.error (__tests__/console.test.js:16:11)" `; exports[`console printing 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`console printing with --verbose 1`] = ` - console.log +" console.log This is a log message. at Object.log (__tests__/console.test.js:10:11) @@ -83,26 +83,26 @@ exports[`console printing with --verbose 1`] = ` 18 | at Object.error (__tests__/console.test.js:16:11) - +" `; exports[`console printing with --verbose 2`] = ` -PASS __tests__/console.test.js - ✓ works just fine +"PASS __tests__/console.test.js + ✓ works just fine" `; exports[`console printing with --verbose 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; -exports[`does not error out when using winston 1`] = ``; +exports[`does not error out when using winston 1`] = `""`; exports[`does not error out when using winston 2`] = ` -PASS __tests__/console.test.js +"PASS __tests__/console.test.js ● Console console.log @@ -123,30 +123,30 @@ PASS __tests__/console.test.js console.log {"level":"error","message":"Error message from winston"} - at Console.log (node_modules/winston/lib/winston/transports/console.js:79:23) + at Console.log (node_modules/winston/lib/winston/transports/console.js:79:23)" `; exports[`does not error out when using winston 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; -exports[`does not print to console with --silent 1`] = ``; +exports[`does not print to console with --silent 1`] = `""`; -exports[`does not print to console with --silent 2`] = `PASS __tests__/console.test.js`; +exports[`does not print to console with --silent 2`] = `"PASS __tests__/console.test.js"`; exports[`does not print to console with --silent 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total -Time: <> +Time: <>" `; exports[`respects --noStackTrace 1`] = ` - console.log +" console.log This is a log message. at Object.log (__tests__/console.test.js:10:11) @@ -165,24 +165,24 @@ exports[`respects --noStackTrace 1`] = ` This is an error message. at Object.error (__tests__/console.test.js:16:11) - +" `; exports[`respects --noStackTrace 2`] = ` -PASS __tests__/console.test.js - ✓ works just fine +"PASS __tests__/console.test.js + ✓ works just fine" `; exports[`respects --noStackTrace 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`respects noStackTrace in config 1`] = ` - console.log +" console.log This is a log message. at Object.log (__tests__/console.test.js:10:11) @@ -201,33 +201,33 @@ exports[`respects noStackTrace in config 1`] = ` This is an error message. at Object.error (__tests__/console.test.js:16:11) - +" `; exports[`respects noStackTrace in config 2`] = ` -PASS __tests__/console.test.js - ✓ works just fine +"PASS __tests__/console.test.js + ✓ works just fine" `; exports[`respects noStackTrace in config 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; -exports[`the jsdom console is the same as the test console 1`] = ``; +exports[`the jsdom console is the same as the test console 1`] = `""`; exports[`the jsdom console is the same as the test console 2`] = ` -PASS __tests__/console.test.js - ✓ can mock console.error calls from jsdom +"PASS __tests__/console.test.js + ✓ can mock console.error calls from jsdom" `; exports[`the jsdom console is the same as the test console 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap index 91426354f382..5d9410e9a079 100644 --- a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`console printing 1`] = ` -PASS __tests__/console.test.js +"PASS __tests__/console.test.js ● Cannot log after tests are done. Did you forget to wait for something async in your test? @@ -13,5 +13,5 @@ PASS __tests__/console.test.js | ^ 13 | }); 14 | }); - 15 | + 15 |" `; diff --git a/e2e/__tests__/__snapshots__/consoleDebugging.test.ts.snap b/e2e/__tests__/__snapshots__/consoleDebugging.test.ts.snap index 9b6414ff5b70..4bc14067c0cf 100644 --- a/e2e/__tests__/__snapshots__/consoleDebugging.test.ts.snap +++ b/e2e/__tests__/__snapshots__/consoleDebugging.test.ts.snap @@ -1,22 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`console debugging with --verbose 1`] = ` - console.log +" console.log test at Object.log (__tests__/console-debugging.test.js:17:11) - +" `; exports[`console debugging with --verbose 2`] = ` -PASS __tests__/console-debugging.test.js - ✓ verbose mode prints console output synchronously +"PASS __tests__/console-debugging.test.js + ✓ verbose mode prints console output synchronously" `; exports[`console debugging with --verbose 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 passed, 1 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap b/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap index 571dd419e639..e092acb545d1 100644 --- a/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap +++ b/e2e/__tests__/__snapshots__/consoleLogOutputWhenRunInBand.test.ts.snap @@ -1,25 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prints console.logs when run with forceExit 1`] = ` -PASS __tests__/a-banana.js +"PASS __tests__/a-banana.js ✓ banana -Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished? +Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?" `; exports[`prints console.logs when run with forceExit 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`prints console.logs when run with forceExit 3`] = ` - console.log +" console.log Hey at Object. (__tests__/a-banana.js:1:1) - +" `; diff --git a/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap b/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap index d9c2f3b6343d..e5955d60852f 100644 --- a/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`code coverage for Handlebars 1`] = ` ------------|---------|----------|---------|---------|------------------- +"-----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- All files | 75 | 61.53 | 66.66 | 66.66 | greet.hbs | 75 | 61.53 | 66.66 | 66.66 | 10 ------------|---------|----------|---------|---------|------------------- +-----------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap b/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap index b3484364de99..58e81f474d72 100644 --- a/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageProviderV8.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`on node >=12.16.0 prints correct coverage report, if a TS module is transpiled by custom transformer to ESM put under test 1`] = ` - console.log +" console.log this will print at covered (module.ts:13:11) @@ -13,11 +13,11 @@ All files | 50 | 25 | 25 | 50 | module.ts | 80.76 | 50 | 50 | 80.76 | 16-18,21-22 types.ts | 0 | 0 | 0 | 0 | 1-8 uncovered.ts | 0 | 0 | 0 | 0 | 1-8 ---------------|---------|----------|---------|---------|------------------- +--------------|---------|----------|---------|---------|-------------------" `; exports[`on node >=12.16.0 prints correct coverage report, if an ESM module is put under test without transformation 1`] = ` - console.log +" console.log this will print at covered (module.js:11:11) @@ -28,11 +28,11 @@ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s All files | 59.37 | 50 | 33.33 | 59.37 | module.js | 79.16 | 66.66 | 50 | 79.16 | 14-16,19-20 uncovered.js | 0 | 0 | 0 | 0 | 1-8 ---------------|---------|----------|---------|---------|------------------- +--------------|---------|----------|---------|---------|-------------------" `; exports[`prints correct coverage report, if a CJS module is put under test without transformation 1`] = ` - console.log +" console.log this will print at covered (module.js:11:11) @@ -43,11 +43,11 @@ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s All files | 59.37 | 60 | 50 | 59.37 | module.js | 79.16 | 75 | 66.66 | 79.16 | 14-16,19-20 uncovered.js | 0 | 0 | 0 | 0 | 1-8 ---------------|---------|----------|---------|---------|------------------- +--------------|---------|----------|---------|---------|-------------------" `; exports[`prints correct coverage report, if a TS module is transpiled by Babel to CJS and put under test 1`] = ` - console.log +" console.log this will print at log (module.ts:13:11) @@ -59,20 +59,20 @@ All files | 50 | 25 | 25 | 50 | module.ts | 80.76 | 50 | 50 | 80.76 | 16-18,21-22 types.ts | 0 | 0 | 0 | 0 | 1-8 uncovered.ts | 0 | 0 | 0 | 0 | 1-8 ---------------|---------|----------|---------|---------|------------------- +--------------|---------|----------|---------|---------|-------------------" `; exports[`prints coverage with empty sourcemaps 1`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | types.ts | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; exports[`prints coverage with missing sourcemaps 1`] = ` - console.log +" console.log 42 at Object.log (__tests__/Thing.test.js:10:9) @@ -83,5 +83,5 @@ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s All files | 100 | 100 | 100 | 100 | Thing.js | 100 | 100 | 100 | 100 | x.css | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap b/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap index 423578892b35..517ac85832d8 100644 --- a/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`collects coverage from duplicate files avoiding shared cache 1`] = ` ----------------|---------|----------|---------|---------|------------------- +"---------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | @@ -9,41 +9,41 @@ All files | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | b | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | ----------------|---------|----------|---------|---------|------------------- +---------------|---------|----------|---------|---------|-------------------" `; exports[`collects coverage only from multiple specified files 1`] = ` ---------------|---------|----------|---------|---------|------------------- +"--------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s --------------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | file.js | 100 | 100 | 100 | 100 | otherFile.js | 100 | 100 | 100 | 100 | ---------------|---------|----------|---------|---------|------------------- +--------------|---------|----------|---------|---------|-------------------" `; exports[`collects coverage only from specified file 1`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | file.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; exports[`collects coverage only from specified files avoiding dependencies 1`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 87.5 | 100 | 50 | 100 | sum.js | 87.5 | 100 | 50 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; -exports[`does not output coverage report when html is requested 1`] = ``; +exports[`does not output coverage report when html is requested 1`] = `""`; exports[`generates coverage when using the testRegex config param 1`] = ` --------------------------------------|---------|----------|---------|---------|------------------- +"-------------------------------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- All files | 60 | 0 | 50 | 60 | @@ -57,19 +57,19 @@ All files | 60 | 0 | 50 | 60 | identical.js | 100 | 100 | 100 | 100 | coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | --------------------------------------|---------|----------|---------|---------|------------------- +-------------------------------------|---------|----------|---------|---------|-------------------" `; exports[`json reporter printing with --coverage 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 2 passed, 3 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`outputs coverage report 1`] = ` --------------------------------------|---------|----------|---------|---------|------------------- +"-------------------------------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- All files | 60 | 0 | 50 | 60 | @@ -83,11 +83,11 @@ All files | 60 | 0 | 50 | 60 | identical.js | 100 | 100 | 100 | 100 | coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | --------------------------------------|---------|----------|---------|---------|------------------- +-------------------------------------|---------|----------|---------|---------|-------------------" `; exports[`outputs coverage report when text and text-summary is requested 1`] = ` - +" =============================== Coverage summary =============================== Statements : 60% ( 15/25 ) Branches : 0% ( 0/4 ) @@ -108,11 +108,11 @@ All files | 60 | 0 | 50 | 60 | identical.js | 100 | 100 | 100 | 100 | coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | --------------------------------------|---------|----------|---------|---------|------------------- +-------------------------------------|---------|----------|---------|---------|-------------------" `; exports[`outputs coverage report when text is requested 1`] = ` --------------------------------------|---------|----------|---------|---------|------------------- +"-------------------------------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- All files | 60 | 0 | 50 | 60 | @@ -126,15 +126,15 @@ All files | 60 | 0 | 50 | 60 | identical.js | 100 | 100 | 100 | 100 | coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | identical.js | 100 | 100 | 100 | 100 | --------------------------------------|---------|----------|---------|---------|------------------- +-------------------------------------|---------|----------|---------|---------|-------------------" `; exports[`outputs coverage report when text-summary is requested 1`] = ` - +" =============================== Coverage summary =============================== Statements : 60% ( 15/25 ) Branches : 0% ( 0/4 ) Functions : 50% ( 3/6 ) Lines : 60% ( 12/20 ) -================================================================================ +================================================================================" `; diff --git a/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap b/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap index 2357c88f67c0..0fe03e7e827b 100644 --- a/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap @@ -1,109 +1,109 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`excludes tests matched by path threshold groups from global group 1`] = ` -PASS __tests__/banana.test.js +"PASS __tests__/banana.test.js ✓ banana -Jest: "global" coverage threshold for lines (100%) not met: 0% +Jest: "global" coverage threshold for lines (100%) not met: 0%" `; exports[`excludes tests matched by path threshold groups from global group 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`excludes tests matched by path threshold groups from global group: stdout 1`] = ` ------------|---------|----------|---------|---------|------------------- +"-----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- All files | 50 | 100 | 50 | 50 | apple.js | 0 | 100 | 0 | 0 | 1-2 banana.js | 100 | 100 | 100 | 100 | ------------|---------|----------|---------|---------|------------------- +-----------|---------|----------|---------|---------|-------------------" `; exports[`exits with 0 if global threshold group is not found in coverage data: stdout 1`] = ` ------------|---------|----------|---------|---------|------------------- +"-----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | banana.js | 100 | 100 | 100 | 100 | ------------|---------|----------|---------|---------|------------------- +-----------|---------|----------|---------|---------|-------------------" `; exports[`exits with 1 if coverage threshold is not met 1`] = ` -PASS __tests__/a-banana.js +"PASS __tests__/a-banana.js ✓ banana -Jest: "global" coverage threshold for lines (90%) not met: 50% +Jest: "global" coverage threshold for lines (90%) not met: 50%" `; exports[`exits with 1 if coverage threshold is not met 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`exits with 1 if coverage threshold is not met: stdout 1`] = ` -----------------|---------|----------|---------|---------|------------------- +"----------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------------|---------|----------|---------|---------|------------------- All files | 50 | 100 | 0 | 50 | not-covered.js | 50 | 100 | 0 | 50 | 2 -----------------|---------|----------|---------|---------|------------------- +----------------|---------|----------|---------|---------|-------------------" `; exports[`exits with 1 if path threshold group is not found in coverage data 1`] = ` -PASS __tests__/banana.test.js +"PASS __tests__/banana.test.js ✓ banana -Jest: Coverage data for apple.js was not found. +Jest: Coverage data for apple.js was not found." `; exports[`exits with 1 if path threshold group is not found in coverage data 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`exits with 1 if path threshold group is not found in coverage data: stdout 1`] = ` ------------|---------|----------|---------|---------|------------------- +"-----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | banana.js | 100 | 100 | 100 | 100 | ------------|---------|----------|---------|---------|------------------- +-----------|---------|----------|---------|---------|-------------------" `; exports[`file is matched by all path and glob threshold groups 1`] = ` -PASS __tests__/banana.test.js +"PASS __tests__/banana.test.js ✓ banana Jest: "./" coverage threshold for lines (100%) not met: 50% Jest: "<>" coverage threshold for lines (100%) not met: 50% -Jest: "./banana.js" coverage threshold for lines (100%) not met: 50% +Jest: "./banana.js" coverage threshold for lines (100%) not met: 50%" `; exports[`file is matched by all path and glob threshold groups 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`file is matched by all path and glob threshold groups: stdout 1`] = ` ------------|---------|----------|---------|---------|------------------- +"-----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- All files | 50 | 100 | 0 | 50 | banana.js | 50 | 100 | 0 | 50 | 2 ------------|---------|----------|---------|---------|------------------- +-----------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap b/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap index 0753ddeb2565..3c71d5f02fe0 100644 --- a/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`produces code coverage for uncovered files without transformer 1`] = ` ----------------------|---------|----------|---------|---------|------------------- +"---------------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------|---------|----------|---------|---------|------------------- All files | 0 | 100 | 0 | 0 | some-random-file.js | 0 | 100 | 0 | 0 | 8-10 ----------------------|---------|----------|---------|---------|------------------- +---------------------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap b/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap index f64495ccbfaa..42e0de014d00 100644 --- a/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`can bail with a custom inline snapshot matcher 1`] = ` -FAIL __tests__/bail.test.js +"FAIL __tests__/bail.test.js ✕ transitions as expected ● transitions as expected @@ -25,11 +25,11 @@ FAIL __tests__/bail.test.js › 1 snapshot failed. Snapshot Summary - › 1 snapshot failed from 1 test suite. Inspect your code changes or re-run jest with \`-u\` to update them. + › 1 snapshot failed from 1 test suite. Inspect your code changes or re-run jest with \`-u\` to update them." `; exports[`works with custom inline snapshot matchers 1`] = ` -FAIL __tests__/asynchronous.test.js +"FAIL __tests__/asynchronous.test.js ✕ new async, inline snapshots ✕ mismatching async, inline snapshots @@ -117,5 +117,5 @@ FAIL __tests__/asynchronous.test.js › 4 snapshots failed. Snapshot Summary - › 4 snapshots failed from 1 test suite. Inspect your code changes or re-run jest with \`-u\` to update them. + › 4 snapshots failed from 1 test suite. Inspect your code changes or re-run jest with \`-u\` to update them." `; diff --git a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap index c863576b0658..563d3d74599e 100644 --- a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`custom async matchers 1`] = ` -FAIL __tests__/asynchronous.test.js +"FAIL __tests__/asynchronous.test.js ✕ showing the stack trace for an async matcher ● showing the stack trace for an async matcher @@ -16,11 +16,11 @@ FAIL __tests__/asynchronous.test.js 13 | function toThrowCustomAsyncMatcherError() { 14 | const message = () => - at Object.toThrowCustomAsyncMatcherError (__tests__/asynchronous.test.js:11:16) + at Object.toThrowCustomAsyncMatcherError (__tests__/asynchronous.test.js:11:16)" `; exports[`works with custom matchers 1`] = ` -FAIL __tests__/sync.test.js +"FAIL __tests__/sync.test.js Custom matcher ✓ passes ✓ fails @@ -43,5 +43,5 @@ FAIL __tests__/sync.test.js at bar (__tests__/sync.test.js:42:23) at foo (__tests__/sync.test.js:52:7) at Object.callback (__tests__/sync.test.js:11:18) - at Object.toCustomMatch (__tests__/sync.test.js:53:8) + at Object.toCustomMatch (__tests__/sync.test.js:53:8)" `; diff --git a/e2e/__tests__/__snapshots__/customReporters.test.ts.snap b/e2e/__tests__/__snapshots__/customReporters.test.ts.snap index 42ac5525f00e..43299913cba8 100644 --- a/e2e/__tests__/__snapshots__/customReporters.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customReporters.test.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Custom Reporters Integration IncompleteReporter for flexibility 1`] = ` -onRunComplete is called +"onRunComplete is called Passed Tests: 1 Failed Tests: 0 -Total Tests: 1 +Total Tests: 1" `; exports[`Custom Reporters Integration TestReporter with all tests failing 1`] = ` @@ -64,17 +64,17 @@ Object { `; exports[`Custom Reporters Integration default reporters enabled 1`] = ` -PASS __tests__/add.test.js +"PASS __tests__/add.test.js Custom Reporters - ✓ adds ok + ✓ adds ok" `; exports[`Custom Reporters Integration default reporters enabled 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /add.test.js/i. +Ran all test suites matching /add.test.js/i." `; exports[`Custom Reporters Integration default reporters enabled 3`] = ` @@ -102,7 +102,7 @@ Object { `; exports[`Custom Reporters Integration invalid format for adding reporters 1`] = ` -● Reporter Validation Error: +"● Reporter Validation Error: Unexpected value for Path at index 0 of reporter at index 0 Expected: @@ -116,18 +116,18 @@ exports[`Custom Reporters Integration invalid format for adding reporters 1`] = Configuration Documentation: https://jestjs.io/docs/configuration - +" `; exports[`Custom Reporters Integration reporters can be default exports 1`] = ` -run start +"run start test start test complete -run complete +run complete" `; exports[`Custom Reporters Integration valid array format for adding reporters 1`] = ` -{ +"{ "onRunComplete": { "called": true, "numPassedTests": 1, @@ -149,5 +149,5 @@ exports[`Custom Reporters Integration valid array format for adding reporters 1` "options": { "Aaron Abramov": "Awesome" } -} +}" `; diff --git a/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap b/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap index cdc94ba78406..3990f96002bf 100644 --- a/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap +++ b/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`errors if describe returns a Promise 1`] = ` - Returning a Promise from "describe" is not supported. Tests must be defined synchronously. +" Returning a Promise from "describe" is not supported. Tests must be defined synchronously. 9 | 'use strict'; 10 | @@ -11,11 +11,11 @@ exports[`errors if describe returns a Promise 1`] = ` 13 | return Promise.resolve(); 14 | }); - at Object.describe (__tests__/describeReturnPromise.test.js:11:1) + at Object.describe (__tests__/describeReturnPromise.test.js:11:1)" `; exports[`errors if describe returns something 1`] = ` - A "describe" callback must not return a value. +" A "describe" callback must not return a value. 9 | 'use strict'; 10 | @@ -25,5 +25,5 @@ exports[`errors if describe returns something 1`] = ` 13 | return 42; 14 | }); - at Object.describe (__tests__/describeReturnSomething.test.js:11:1) + at Object.describe (__tests__/describeReturnSomething.test.js:11:1)" `; diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap index 42094ed3b596..c6f4f2ec3518 100644 --- a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap +++ b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`does not print info about open handlers for a server that is already closed 1`] = ``; +exports[`does not print info about open handlers for a server that is already closed 1`] = `""`; -exports[`prints message about flag on forceExit 1`] = `Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?`; +exports[`prints message about flag on forceExit 1`] = `"Force exiting Jest: Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?"`; exports[`prints message about flag on slow tests 1`] = ` -Jest did not exit one second after the test run has completed. +"Jest did not exit one second after the test run has completed. -This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with \`--detectOpenHandles\` to troubleshoot this issue. +This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with \`--detectOpenHandles\` to troubleshoot this issue." `; exports[`prints out info about open handlers 1`] = ` -Jest has detected the following 1 open handle potentially keeping Jest from exiting: +"Jest has detected the following 1 open handle potentially keeping Jest from exiting: ● TCPSERVERWRAP @@ -22,11 +22,11 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit 15 | at Object.listen (server.js:14:5) - at Object.require (__tests__/outside.js:8:1) + at Object.require (__tests__/outside.js:8:1)" `; exports[`prints out info about open handlers from inside tests 1`] = ` -Jest has detected the following 1 open handle potentially keeping Jest from exiting: +"Jest has detected the following 1 open handle potentially keeping Jest from exiting: ● Timeout @@ -38,11 +38,11 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit 11 | }); 12 | - at Object.setTimeout (__tests__/inside.js:9:3) + at Object.setTimeout (__tests__/inside.js:9:3)" `; exports[`prints out info about open handlers from lifecycle functions with a \`done\` callback 1`] = ` -Jest has detected the following 1 open handle potentially keeping Jest from exiting: +"Jest has detected the following 1 open handle potentially keeping Jest from exiting: ● Timeout @@ -54,11 +54,11 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit 11 | }); 12 | - at setTimeout (__tests__/in-done-lifecycle.js:9:3) + at setTimeout (__tests__/in-done-lifecycle.js:9:3)" `; exports[`prints out info about open handlers from tests with a \`done\` callback 1`] = ` -Jest has detected the following 1 open handle potentially keeping Jest from exiting: +"Jest has detected the following 1 open handle potentially keeping Jest from exiting: ● Timeout @@ -70,5 +70,5 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit 11 | done(); 12 | }); - at Object.setTimeout (__tests__/in-done-function.js:9:3) + at Object.setTimeout (__tests__/in-done-function.js:9:3)" `; diff --git a/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap b/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap index 6252d8c45e52..d137c76c46ae 100644 --- a/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap +++ b/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap @@ -9,7 +9,7 @@ exports[`should work without error 1`] = ` expect(received).toBe(expected) // Object.is equality - If it should pass with deep equality, replace \\"toBe\\" with \\"toStrictEqual\\" + If it should pass with deep equality, replace "toBe" with "toStrictEqual" Expected:
Received: serializes to the same string diff --git a/e2e/__tests__/__snapshots__/each.test.ts.snap b/e2e/__tests__/__snapshots__/each.test.ts.snap index ba7e582f5982..cd99de4520bb 100644 --- a/e2e/__tests__/__snapshots__/each.test.ts.snap +++ b/e2e/__tests__/__snapshots__/each.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`formats args with pretty format when given %p 1`] = ` -PASS __tests__/pretty.test.js +"PASS __tests__/pretty.test.js array ✓ "hello" == "hello" ✓ 1 == 1 @@ -29,20 +29,20 @@ PASS __tests__/pretty.test.js ✓ [[Object]] == [[Object]] ✓ Infinity == Infinity ✓ -Infinity == -Infinity - ✓ NaN == NaN + ✓ NaN == NaN" `; exports[`runs only the describe.only.each tests 1`] = ` -PASS __tests__/describeOnly.test.js +"PASS __tests__/describeOnly.test.js passes all rows expected true == true ✓ passes ✓ passes fails all rows expected false == true - ○ skipped fails + ○ skipped fails" `; exports[`shows error message when not enough arguments are supplied to tests 1`] = ` -FAIL __tests__/eachException.test.js +"FAIL __tests__/eachException.test.js ✕ throws exception when one argument too few are supplied $left == $right ✕ throws exception when not enough arguments are supplied $left == $right @@ -91,11 +91,11 @@ FAIL __tests__/eachException.test.js 21 | \${true} | \${true} 22 | \`( - at Object. (__tests__/eachException.test.js:19:1) + at Object. (__tests__/eachException.test.js:19:1)" `; exports[`shows only the tests with .only as being ran 1`] = ` -PASS __tests__/eachOnly.test.js +"PASS __tests__/eachOnly.test.js ✓ passes one row expected true == true ✓ passes one row expected true == true ✓ passes one row expected true == true @@ -103,11 +103,11 @@ PASS __tests__/eachOnly.test.js ○ skipped Should not be ran: fails all rows expected true == false ○ skipped Should not be ran: fails all rows expected true == true ○ skipped Should not be ran: fails all rows expected true == false - ○ skipped Should not be ran: fails all rows expected true == false + ○ skipped Should not be ran: fails all rows expected true == false" `; exports[`shows only the tests without .skip as being ran 1`] = ` -PASS __tests__/eachSkip.test.js +"PASS __tests__/eachSkip.test.js ✓ passes one row expected true == true ✓ passes one row expected true == true ✓ passes one row expected true == true @@ -118,11 +118,11 @@ PASS __tests__/eachSkip.test.js ○ skipped Should not be ran: fails all rows expected true == false passes all rows expected true == true ○ skipped passes - ○ skipped passes + ○ skipped passes" `; exports[`shows the correct errors in stderr when failing tests 1`] = ` -FAIL __tests__/failure.test.js +"FAIL __tests__/failure.test.js ✓ array table fails on one row: expected true == true ✕ array table fails on one row: expected true == false ✕ array table fails on all rows expected 1 == 2 @@ -362,5 +362,5 @@ FAIL __tests__/failure.test.js 73 | }, 74 | ); - at Object.toBe (__tests__/failure.test.js:71:20) + at Object.toBe (__tests__/failure.test.js:71:20)" `; diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap index 23d77f190aff..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 after it has been torn down. From __tests__/afterTeardown.test.js. +"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(() => { @@ -9,5 +9,5 @@ ReferenceError: You are trying to access a property or method of the Jest enviro | ^ 12 | }, 0); 13 | }); - 14 | + 14 |" `; diff --git a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap index 1e1b33645aee..8c4a72d95339 100644 --- a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap +++ b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`defaultTimeoutInterval.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/defaultTimeoutInterval.test.js +"FAIL __tests__/defaultTimeoutInterval.test.js ✕ Default Timeout Interval ● Default Timeout Interval @@ -16,11 +16,11 @@ FAIL __tests__/defaultTimeoutInterval.test.js 12 | }); 13 | - at Object. (__tests__/defaultTimeoutInterval.test.js:10:3) + at Object. (__tests__/defaultTimeoutInterval.test.js:10:3)" `; exports[`fail.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/fail.test.js +"FAIL __tests__/fail.test.js ✕ fail ● fail @@ -35,11 +35,11 @@ FAIL __tests__/fail.test.js 13 | }); 14 | - at Object.fail (__tests__/fail.test.js:11:5) + at Object.fail (__tests__/fail.test.js:11:5)" `; exports[`jasmine.addMatchers.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.addMatchers.test.js +"FAIL __tests__/jasmine.addMatchers.test.js ● Test suite failed to run Illegal usage of \`jasmine.addMatchers\`, prefer \`expect.extends\`. @@ -52,11 +52,11 @@ FAIL __tests__/jasmine.addMatchers.test.js 11 | compare: (actual, expected) => ({ 12 | message: 'Nobdy expects the Spanish Inquisition!', - at Object.addMatchers (__tests__/jasmine.addMatchers.test.js:9:9) + at Object.addMatchers (__tests__/jasmine.addMatchers.test.js:9:9)" `; exports[`jasmine.any.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.any.test.js +"FAIL __tests__/jasmine.any.test.js ✕ jasmine.any ● jasmine.any @@ -70,11 +70,11 @@ FAIL __tests__/jasmine.any.test.js 11 | }); 12 | - at Object.any (__tests__/jasmine.any.test.js:10:51) + at Object.any (__tests__/jasmine.any.test.js:10:51)" `; exports[`jasmine.anything.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.anything.test.js +"FAIL __tests__/jasmine.anything.test.js ✕ jasmine.anything ● jasmine.anything @@ -88,11 +88,11 @@ FAIL __tests__/jasmine.anything.test.js 11 | }); 12 | - at Object.anything (__tests__/jasmine.anything.test.js:10:62) + at Object.anything (__tests__/jasmine.anything.test.js:10:62)" `; exports[`jasmine.arrayContaining.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.arrayContaining.test.js +"FAIL __tests__/jasmine.arrayContaining.test.js ✕ jasmine.arrayContaining ● jasmine.arrayContaining @@ -106,11 +106,11 @@ FAIL __tests__/jasmine.arrayContaining.test.js 11 | }); 12 | - at Object.arrayContaining (__tests__/jasmine.arrayContaining.test.js:10:45) + at Object.arrayContaining (__tests__/jasmine.arrayContaining.test.js:10:45)" `; exports[`jasmine.createSpy.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.createSpy.test.js +"FAIL __tests__/jasmine.createSpy.test.js ✕ jasmine.createSpy ● jasmine.createSpy @@ -125,11 +125,11 @@ FAIL __tests__/jasmine.createSpy.test.js 12 | expect(mySpy).toHaveBeenCalledWith('hello?'); 13 | }); - at Object.createSpy (__tests__/jasmine.createSpy.test.js:10:25) + at Object.createSpy (__tests__/jasmine.createSpy.test.js:10:25)" `; exports[`jasmine.objectContaining.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.objectContaining.test.js +"FAIL __tests__/jasmine.objectContaining.test.js ✕ jasmine.objectContaining ● jasmine.objectContaining @@ -144,11 +144,11 @@ FAIL __tests__/jasmine.objectContaining.test.js 13 | }); 14 | - at Object.objectContaining (__tests__/jasmine.objectContaining.test.js:11:13) + at Object.objectContaining (__tests__/jasmine.objectContaining.test.js:11:13)" `; exports[`jasmine.stringMatching.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/jasmine.stringMatching.test.js +"FAIL __tests__/jasmine.stringMatching.test.js ✕ jasmine.stringMatching ● jasmine.stringMatching @@ -162,11 +162,11 @@ FAIL __tests__/jasmine.stringMatching.test.js 11 | }); 12 | - at Object.stringMatching (__tests__/jasmine.stringMatching.test.js:10:50) + at Object.stringMatching (__tests__/jasmine.stringMatching.test.js:10:50)" `; exports[`pending.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/pending.test.js +"FAIL __tests__/pending.test.js ✕ pending ● pending @@ -181,11 +181,11 @@ FAIL __tests__/pending.test.js 13 | expect(false).toBe(true); 14 | }); - at Object.pending (__tests__/pending.test.js:11:5) + at Object.pending (__tests__/pending.test.js:11:5)" `; exports[`spyOn.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/spyOn.test.js +"FAIL __tests__/spyOn.test.js ✕ spyOn ● spyOn @@ -200,11 +200,11 @@ FAIL __tests__/spyOn.test.js 17 | }); 18 | - at Object.spyOn (__tests__/spyOn.test.js:15:3) + at Object.spyOn (__tests__/spyOn.test.js:15:3)" `; exports[`spyOnProperty.test.js errors in errorOnDeprecated mode 1`] = ` -FAIL __tests__/spyOnProperty.test.js +"FAIL __tests__/spyOnProperty.test.js ✕ spyOnProperty ● spyOnProperty @@ -219,5 +219,5 @@ FAIL __tests__/spyOnProperty.test.js 26 | obj.method(); 27 | - at Object.spyOnProperty (__tests__/spyOnProperty.test.js:24:15) + at Object.spyOnProperty (__tests__/spyOnProperty.test.js:24:15)" `; diff --git a/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap b/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap index 39ebcb0c37c3..68cf94c67c7c 100644 --- a/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap +++ b/e2e/__tests__/__snapshots__/executeTestsOnceInMpr.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Tests are executed only once even in an MPR 1`] = ` -PASS foo/folder/my-test-bar.js - ✓ bar +"PASS foo/folder/my-test-bar.js + ✓ bar" `; diff --git a/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap b/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap index 27fac20aeced..fbafcfaa2d73 100644 --- a/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap +++ b/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`shows the correct errors in stderr when failing tests 1`] = ` -FAIL __tests__/failure.test.js +"FAIL __tests__/failure.test.js ✕ fail with expected non promise values ✕ fail with expected non promise values and not ✕ fail with expected promise values @@ -81,5 +81,5 @@ FAIL __tests__/failure.test.js 24 | )); 25 | - at Object.toHaveLengthAsync (__tests__/failure.test.js:22:48) + at Object.toHaveLengthAsync (__tests__/failure.test.js:22:48)" `; diff --git a/e2e/__tests__/__snapshots__/failures.test.ts.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap index 87f8497721ae..c570616b4240 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`not throwing Error objects 1`] = ` -FAIL __tests__/throwNumber.test.js +"FAIL __tests__/throwNumber.test.js ● Test suite failed to run - Expected an Error, but "1" was thrown + Expected an Error, but "1" was thrown" `; exports[`not throwing Error objects 2`] = ` -FAIL __tests__/throwString.test.js +"FAIL __tests__/throwString.test.js ● Test suite failed to run - banana + banana" `; exports[`not throwing Error objects 3`] = ` -FAIL __tests__/throwObject.test.js +"FAIL __tests__/throwObject.test.js ● Test suite failed to run - thrown: Object {} + thrown: Object {}" `; exports[`not throwing Error objects 4`] = ` -FAIL __tests__/assertionCount.test.js +"FAIL __tests__/assertionCount.test.js .assertions() ✕ throws ✕ throws on redeclare of assertion count @@ -108,11 +108,11 @@ FAIL __tests__/assertionCount.test.js 28 | 29 | describe('.assertions()', () => { - at Object.hasAssertions (__tests__/assertionCount.test.js:26:10) + at Object.hasAssertions (__tests__/assertionCount.test.js:26:10)" `; exports[`not throwing Error objects 5`] = ` -FAIL __tests__/duringTests.test.js +"FAIL __tests__/duringTests.test.js ✕ Promise thrown during test ✕ Boolean thrown during test ✕ undefined thrown during test @@ -268,21 +268,21 @@ FAIL __tests__/duringTests.test.js | ^ 51 | - at Object.test (__tests__/duringTests.test.js:50:1) + at Object.test (__tests__/duringTests.test.js:50:1)" `; exports[`not throwing Error objects 6`] = ` -FAIL __tests__/throwObjectWithStackProp.test.js +"FAIL __tests__/throwObjectWithStackProp.test.js ● Test suite failed to run thrown: Object { "stack": 42, - } + }" `; exports[`works with assertions in separate files 1`] = ` -FAIL __tests__/testMacro.test.js +"FAIL __tests__/testMacro.test.js ✕ use some imported macro to make assertion ● use some imported macro to make assertion @@ -300,11 +300,11 @@ FAIL __tests__/testMacro.test.js 12 | at toEqual (macros.js:10:15) - at Object.shouldEqual (__tests__/testMacro.test.js:13:3) + at Object.shouldEqual (__tests__/testMacro.test.js:13:3)" `; exports[`works with async failures 1`] = ` -FAIL __tests__/asyncFailures.test.js +"FAIL __tests__/asyncFailures.test.js ✕ resolve, but fail ✕ reject, but fail ✕ expect reject @@ -401,11 +401,11 @@ FAIL __tests__/asyncFailures.test.js 24 | }, 5); 25 | - at Object.test (__tests__/asyncFailures.test.js:22:1) + at Object.test (__tests__/asyncFailures.test.js:22:1)" `; exports[`works with node assert 1`] = ` -FAIL __tests__/assertionError.test.js +"FAIL __tests__/assertionError.test.js ✕ assert ✕ assert with a message ✕ assert.ok @@ -858,11 +858,11 @@ FAIL __tests__/assertionError.test.js 89 | }); 90 | - at Object.fail (__tests__/assertionError.test.js:88:10) + at Object.fail (__tests__/assertionError.test.js:88:10)" `; exports[`works with snapshot failures 1`] = ` -FAIL __tests__/snapshot.test.js +"FAIL __tests__/snapshot.test.js ✕ failing snapshot ● failing snapshot @@ -884,11 +884,11 @@ FAIL __tests__/snapshot.test.js at Object.toMatchSnapshot (__tests__/snapshot.test.js:11:17) › 1 snapshot failed. - +" `; exports[`works with snapshot failures with hint 1`] = ` -FAIL __tests__/snapshotWithHint.test.js +"FAIL __tests__/snapshotWithHint.test.js ✕ failing snapshot with hint ● failing snapshot with hint @@ -910,5 +910,5 @@ FAIL __tests__/snapshotWithHint.test.js at Object.toMatchSnapshot (__tests__/snapshotWithHint.test.js:11:17) › 1 snapshot failed. - +" `; diff --git a/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap b/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap index d7cf67285466..d21e158b8bf1 100644 --- a/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap +++ b/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap @@ -1,68 +1,68 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`--findRelatedTests flag coverage configuration is applied correctly 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites related to files matching /a.js|b.js/i. +Ran all test suites related to files matching /a.js|b.js/i." `; exports[`--findRelatedTests flag coverage configuration is applied correctly 2`] = ` -PASS __tests__/a.test.js -✓ a +"PASS __tests__/a.test.js +✓ a" `; exports[`--findRelatedTests flag coverage configuration is applied correctly 3`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | a.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; exports[`--findRelatedTests flag generates coverage report for filename 1`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 2 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`--findRelatedTests flag generates coverage report for filename 2`] = ` -PASS __tests__/a.test.js -PASS __tests__/b.test.js +"PASS __tests__/a.test.js +PASS __tests__/b.test.js" `; exports[`--findRelatedTests flag generates coverage report for filename 3`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | a.js | 100 | 100 | 100 | 100 | b.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; exports[`--findRelatedTests flag generates coverage report for filename 4`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites related to files matching /a.js/i. +Ran all test suites related to files matching /a.js/i." `; exports[`--findRelatedTests flag generates coverage report for filename 5`] = ` -PASS __tests__/a.test.js - ✓ a +"PASS __tests__/a.test.js + ✓ a" `; exports[`--findRelatedTests flag generates coverage report for filename 6`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | a.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/globals.test.ts.snap b/e2e/__tests__/__snapshots__/globals.test.ts.snap index c8f6286b7360..e9071a204e06 100644 --- a/e2e/__tests__/__snapshots__/globals.test.ts.snap +++ b/e2e/__tests__/__snapshots__/globals.test.ts.snap @@ -1,24 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`basic test constructs 1`] = ` -PASS __tests__/basic.testConstructs.test.js +"PASS __tests__/basic.testConstructs.test.js ✓ it ✓ test describe ✓ it - ✓ test + ✓ test" `; exports[`basic test constructs 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 4 passed, 4 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`cannot have describe with no implementation 1`] = ` -FAIL __tests__/onlyConstructs.test.js +"FAIL __tests__/onlyConstructs.test.js ● Test suite failed to run Missing second argument. It must be a callback function. @@ -26,19 +26,19 @@ FAIL __tests__/onlyConstructs.test.js > 1 | describe('describe, no implementation'); | ^ - at Object. (__tests__/onlyConstructs.test.js:1:10) + at Object. (__tests__/onlyConstructs.test.js:1:10)" `; exports[`cannot have describe with no implementation 2`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`cannot test with no implementation 1`] = ` -FAIL __tests__/onlyConstructs.test.js +"FAIL __tests__/onlyConstructs.test.js ● Test suite failed to run Missing second argument. It must be a callback function. Perhaps you want to use \`test.todo\` for a test placeholder. @@ -48,19 +48,19 @@ FAIL __tests__/onlyConstructs.test.js | ^ 3 | test('test, no implementation'); - at Object.it (__tests__/onlyConstructs.test.js:2:1) + at Object.it (__tests__/onlyConstructs.test.js:2:1)" `; exports[`cannot test with no implementation 2`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`cannot test with no implementation with expand arg 1`] = ` -FAIL __tests__/onlyConstructs.test.js +"FAIL __tests__/onlyConstructs.test.js ● Test suite failed to run Missing second argument. It must be a callback function. Perhaps you want to use \`test.todo\` for a test placeholder. @@ -70,49 +70,49 @@ FAIL __tests__/onlyConstructs.test.js | ^ 3 | test('test, no implementation'); - at Object.it (__tests__/onlyConstructs.test.js:2:1) + at Object.it (__tests__/onlyConstructs.test.js:2:1)" `; exports[`cannot test with no implementation with expand arg 2`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`function as descriptor 1`] = ` -PASS __tests__/functionAsDescriptor.test.js +"PASS __tests__/functionAsDescriptor.test.js Foo - ✓ it + ✓ it" `; exports[`function as descriptor 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`interleaved describe and test children order 1`] = ` -PASS __tests__/interleaved.test.js +"PASS __tests__/interleaved.test.js ✓ above ✓ below describe - ✓ inside + ✓ inside" `; exports[`interleaved describe and test children order 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`only 1`] = ` -PASS __tests__/onlyConstructs.test.js +"PASS __tests__/onlyConstructs.test.js ✓ test.only ✓ it.only ✓ fit @@ -123,19 +123,19 @@ PASS __tests__/onlyConstructs.test.js describe.only ✓ test describe - ✓ test + ✓ test" `; exports[`only 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 skipped, 7 passed, 8 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`only with expand arg 1`] = ` -PASS __tests__/onlyConstructs.test.js +"PASS __tests__/onlyConstructs.test.js ○ it ✓ test.only ✓ it.only @@ -146,19 +146,19 @@ PASS __tests__/onlyConstructs.test.js describe.only ✓ test describe - ✓ test + ✓ test" `; exports[`only with expand arg 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 skipped, 7 passed, 8 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`skips 1`] = ` -PASS __tests__/skipsConstructs.test.js +"PASS __tests__/skipsConstructs.test.js ✓ it ○ skipped xtest ○ skipped xit @@ -170,19 +170,19 @@ PASS __tests__/skipsConstructs.test.js describe.skip ○ skipped test describe - ○ skipped test + ○ skipped test" `; exports[`skips 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 8 skipped, 1 passed, 9 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`skips with expand arg 1`] = ` -PASS __tests__/skipsConstructs.test.js +"PASS __tests__/skipsConstructs.test.js ✓ it ○ xtest ○ xit @@ -194,13 +194,13 @@ PASS __tests__/skipsConstructs.test.js describe.skip ○ test describe - ○ test + ○ test" `; exports[`skips with expand arg 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 8 skipped, 1 passed, 9 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/injectGlobals.test.ts.snap b/e2e/__tests__/__snapshots__/injectGlobals.test.ts.snap index ca8a6fffa99b..74c718ed91b9 100644 --- a/e2e/__tests__/__snapshots__/injectGlobals.test.ts.snap +++ b/e2e/__tests__/__snapshots__/injectGlobals.test.ts.snap @@ -1,27 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`globals are undefined if passed \`false\` from CLI 1`] = ` -PASS __tests__/test.js - ✓ no globals injected +"PASS __tests__/test.js + ✓ no globals injected" `; exports[`globals are undefined if passed \`false\` from CLI 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`globals are undefined if passed \`false\` from config 1`] = ` -PASS __tests__/test.js - ✓ no globals injected +"PASS __tests__/test.js + ✓ no globals injected" `; exports[`globals are undefined if passed \`false\` from config 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap b/e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap index 9bf15c021352..45f2b0bcb85b 100644 --- a/e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap +++ b/e2e/__tests__/__snapshots__/jest.config.js.test.ts.snap @@ -1,36 +1,36 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`traverses directory tree up until it finds jest.config 1`] = ` - console.log +" console.log <>/jest-config-js/some/nested/directory at Object.log (__tests__/a-banana.js:3:27) - +" `; exports[`traverses directory tree up until it finds jest.config 2`] = ` -PASS ../../../__tests__/a-banana.js +"PASS ../../../__tests__/a-banana.js ✓ banana - ✓ abc + ✓ abc" `; exports[`traverses directory tree up until it finds jest.config 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`works with jest.config.js 1`] = ` -PASS __tests__/a-banana.js - ✓ banana +"PASS __tests__/a-banana.js + ✓ banana" `; exports[`works with jest.config.js 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/jest.config.ts.test.ts.snap b/e2e/__tests__/__snapshots__/jest.config.ts.test.ts.snap index 5930200701cb..d95343e696fe 100644 --- a/e2e/__tests__/__snapshots__/jest.config.ts.test.ts.snap +++ b/e2e/__tests__/__snapshots__/jest.config.ts.test.ts.snap @@ -1,49 +1,49 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`traverses directory tree up until it finds jest.config 1`] = ` - console.log +" console.log <>/jest-config-ts/some/nested/directory at Object.log (__tests__/a-giraffe.js:3:27) - +" `; exports[`traverses directory tree up until it finds jest.config 2`] = ` -PASS ../../../__tests__/a-giraffe.js +"PASS ../../../__tests__/a-giraffe.js ✓ giraffe - ✓ abc + ✓ abc" `; exports[`traverses directory tree up until it finds jest.config 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`works with jest.config.ts 1`] = ` -PASS __tests__/a-giraffe.js - ✓ giraffe +"PASS __tests__/a-giraffe.js + ✓ giraffe" `; exports[`works with jest.config.ts 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`works with tsconfig.json 1`] = ` -PASS __tests__/a-giraffe.js - ✓ giraffe +"PASS __tests__/a-giraffe.js + ✓ giraffe" `; exports[`works with tsconfig.json 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/listTests.test.ts.snap b/e2e/__tests__/__snapshots__/listTests.test.ts.snap index 45e85ad0206a..519ed836efdb 100644 --- a/e2e/__tests__/__snapshots__/listTests.test.ts.snap +++ b/e2e/__tests__/__snapshots__/listTests.test.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`--listTests flag causes tests to be printed in different lines 1`] = ` -/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/dummy.test.js -/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/other.test.js +"/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/dummy.test.js +/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/other.test.js" `; -exports[`--listTests flag causes tests to be printed out as JSON when using the --json flag 1`] = `["/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/dummy.test.js","/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/other.test.js"]`; +exports[`--listTests flag causes tests to be printed out as JSON when using the --json flag 1`] = `"["/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/dummy.test.js","/MOCK_ABSOLUTE_PATH/e2e/list-tests/__tests__/other.test.js"]"`; diff --git a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap index b2a3571bf7a8..08021660bd7e 100644 --- a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap +++ b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`moduleNameMapper correct configuration 1`] = ` -PASS __tests__/index.js - ✓ moduleNameMapping correct configuration +"PASS __tests__/index.js + ✓ moduleNameMapping correct configuration" `; exports[`moduleNameMapper correct configuration mocking module of absolute path 1`] = ` -PASS __tests__/index.js - ✓ moduleNameMapping correct configuration +"PASS __tests__/index.js + ✓ moduleNameMapping correct configuration" `; exports[`moduleNameMapper wrong array configuration 1`] = ` -FAIL __tests__/index.js +"FAIL __tests__/index.js ● Test suite failed to run Configuration error: @@ -42,11 +42,11 @@ FAIL __tests__/index.js 13 | at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:579:17) - at Object.require (index.js:10:1) + at Object.require (index.js:10:1)" `; exports[`moduleNameMapper wrong configuration 1`] = ` -FAIL __tests__/index.js +"FAIL __tests__/index.js ● Test suite failed to run Configuration error: @@ -71,5 +71,5 @@ FAIL __tests__/index.js 13 | at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:579:17) - at Object.require (index.js:10:1) + at Object.require (index.js:10:1)" `; diff --git a/e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap b/e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap index 43dc5c28220a..bf72a9f9bf37 100644 --- a/e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap +++ b/e2e/__tests__/__snapshots__/multiProjectRunner.test.ts.snap @@ -1,37 +1,37 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`can pass projects or global config 1`] = ` -Test Suites: 3 failed, 3 total +"Test Suites: 3 failed, 3 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`can pass projects or global config 2`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 3 passed, 3 total Snapshots: 0 total Time: <> -Ran all test suites in 3 projects. +Ran all test suites in 3 projects." `; exports[`can pass projects or global config 3`] = ` -PASS BACKEND project1/__tests__/file1.test.js +"PASS BACKEND project1/__tests__/file1.test.js PASS UI project3/__tests__/file1.test.js -PASS project2/__tests__/file1.test.js +PASS project2/__tests__/file1.test.js" `; exports[`can pass projects or global config 4`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 3 passed, 3 total Snapshots: 0 total Time: <> -Ran all test suites in 3 projects. +Ran all test suites in 3 projects." `; exports[`can pass projects or global config 5`] = ` -PASS BACKEND project1/__tests__/file1.test.js +"PASS BACKEND project1/__tests__/file1.test.js PASS UI project3/__tests__/file1.test.js -PASS project2/__tests__/file1.test.js +PASS project2/__tests__/file1.test.js" `; diff --git a/e2e/__tests__/__snapshots__/multipleConfigs.ts.snap b/e2e/__tests__/__snapshots__/multipleConfigs.ts.snap index ae086ee790db..3805df0c73fb 100644 --- a/e2e/__tests__/__snapshots__/multipleConfigs.ts.snap +++ b/e2e/__tests__/__snapshots__/multipleConfigs.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`multiple configs will warn 1`] = ` -● Multiple configurations found: +"● Multiple configurations found: * /e2e/multiple-configs/jest.config.js * /e2e/multiple-configs/jest.config.json * \`jest\` key in /e2e/multiple-configs/package.json @@ -13,13 +13,13 @@ exports[`multiple configs will warn 1`] = ` https://jestjs.io/docs/configuration.html PASS Config from js file __tests__/test.js - ✓ dummy test + ✓ dummy test" `; exports[`multiple configs will warn 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap b/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap index b5a531aca80d..3c01bb2e69eb 100644 --- a/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap +++ b/e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`on node >=12.16.0 runs test with native ESM 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 21 passed, 21 total Snapshots: 0 total Time: <> -Ran all test suites matching /native-esm.test.js/i. +Ran all test suites matching /native-esm.test.js/i." `; exports[`on node >=14.3.0 supports top-level await 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /native-esm.tla.test.js/i. +Ran all test suites matching /native-esm.tla.test.js/i." `; diff --git a/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap b/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap index f1aadd887409..77c28863b93b 100644 --- a/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`print correct error message with nested test definitions inside describe 1`] = ` -FAIL __tests__/nestedTestWithinDescribe.js +"FAIL __tests__/nestedTestWithinDescribe.js in describe ✕ outer test @@ -17,11 +17,11 @@ FAIL __tests__/nestedTestWithinDescribe.js 18 | }); 19 | }); - at Object.test (__tests__/nestedTestWithinDescribe.js:16:5) + at Object.test (__tests__/nestedTestWithinDescribe.js:16:5)" `; exports[`print correct error message with nested test definitions outside describe 1`] = ` -FAIL __tests__/nestedTestOutsideDescribe.js +"FAIL __tests__/nestedTestOutsideDescribe.js ✕ outer test ● outer test @@ -36,5 +36,5 @@ FAIL __tests__/nestedTestOutsideDescribe.js 17 | }); 18 | }); - at Object.test (__tests__/nestedTestOutsideDescribe.js:15:3) + at Object.test (__tests__/nestedTestOutsideDescribe.js:15:3)" `; diff --git a/e2e/__tests__/__snapshots__/processExit.test.ts.snap b/e2e/__tests__/__snapshots__/processExit.test.ts.snap index f2551b7cbcb0..dabf5f003914 100644 --- a/e2e/__tests__/__snapshots__/processExit.test.ts.snap +++ b/e2e/__tests__/__snapshots__/processExit.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prints stack trace pointing to process.exit call 1`] = ` - ● process.exit called with "1" +" ● process.exit called with "1" 6 | */ 7 | @@ -11,5 +11,5 @@ exports[`prints stack trace pointing to process.exit call 1`] = ` 10 | test('something', () => { 11 | expect(true).toBe(true); - at Object.exit (__tests__/test.js:8:9) + at Object.exit (__tests__/test.js:8:9)" `; diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap index 67eae2c94852..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 after the Jest environment has been torn down. From __tests__/lateRequire.test.js. +"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(() => { @@ -9,5 +9,5 @@ ReferenceError: You are trying to \`import\` a file after the Jest environment h | ^ 12 | 13 | expect(double(5)).toBe(10); - 14 | }, 0); + 14 | }, 0);" `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index 46f5c889b68c..b4a32a33567d 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`show error message when no js moduleFileExtensions 1`] = ` -● Validation Error: +"● Validation Error: moduleFileExtensions must include 'js': but instead received: @@ -10,11 +10,11 @@ exports[`show error message when no js moduleFileExtensions 1`] = ` Configuration Documentation: https://jestjs.io/docs/configuration - +" `; exports[`show error message with matching files 1`] = ` -FAIL __tests__/test.js +"FAIL __tests__/test.js ● Test suite failed to run Cannot find module './some-json-file' from 'index.js' @@ -38,5 +38,5 @@ FAIL __tests__/test.js 9 | at Resolver.resolveModule (../../packages/jest-resolve/build/resolver.js:324:11) - at Object.require (index.js:8:18) + at Object.require (index.js:8:18)" `; diff --git a/e2e/__tests__/__snapshots__/runProgrammaticallyMultipleProjects.test.ts.snap b/e2e/__tests__/__snapshots__/runProgrammaticallyMultipleProjects.test.ts.snap index 3362f97f2234..9ffad72f23c0 100644 --- a/e2e/__tests__/__snapshots__/runProgrammaticallyMultipleProjects.test.ts.snap +++ b/e2e/__tests__/__snapshots__/runProgrammaticallyMultipleProjects.test.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`run programmatically with multiple projects: summary 1`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 2 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites in 2 projects. +Ran all test suites in 2 projects." `; diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index 4ca4895bad34..16f770844234 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`--showConfig outputs config info and exits 1`] = ` -{ +"{ "configs": [ { "automock": false, @@ -128,5 +128,5 @@ exports[`--showConfig outputs config info and exits 1`] = ` "watchman": true }, "version": "[version]" -} +}" `; diff --git a/e2e/__tests__/__snapshots__/snapshot.test.ts.snap b/e2e/__tests__/__snapshots__/snapshot.test.ts.snap index cf4fb4518a1a..811a7727b08a 100644 --- a/e2e/__tests__/__snapshots__/snapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/snapshot.test.ts.snap @@ -1,137 +1,137 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Snapshot Validation deletes a snapshot when a test does removes all the snapshots 1`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 9 written, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation deletes a snapshot when a test does removes all the snapshots 2`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 6 passed, 6 total Snapshots: 1 file removed, 5 passed, 5 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation deletes the snapshot if the test suite has been removed 1`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 9 written, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation deletes the snapshot if the test suite has been removed 2`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 1 file removed, 5 passed, 5 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation does not save snapshots in CI mode by default 1`] = ` -Test Suites: 3 failed, 3 total +"Test Suites: 3 failed, 3 total Tests: 7 failed, 2 passed, 9 total Snapshots: 9 failed, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation updates the snapshot when a test removes some snapshots 1`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 9 written, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation updates the snapshot when a test removes some snapshots 2`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 1 removed, 1 updated, 7 passed, 8 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation works on subsequent runs without \`-u\` 1`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 9 written, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot Validation works on subsequent runs without \`-u\` 2`] = ` -Test Suites: 3 passed, 3 total +"Test Suites: 3 passed, 3 total Tests: 9 passed, 9 total Snapshots: 9 passed, 9 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot stores new snapshots on the first run 1`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 5 passed, 5 total Snapshots: 5 written, 5 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`Snapshot works with escaped characters 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 written, 1 total Time: <> -Ran all test suites matching /snapshot.test.js/i. +Ran all test suites matching /snapshot.test.js/i." `; exports[`Snapshot works with escaped characters 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 1 written, 1 passed, 2 total Time: <> -Ran all test suites matching /snapshot.test.js/i. +Ran all test suites matching /snapshot.test.js/i." `; exports[`Snapshot works with escaped characters 3`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 2 passed, 2 total Time: <> -Ran all test suites matching /snapshot.test.js/i. +Ran all test suites matching /snapshot.test.js/i." `; exports[`Snapshot works with escaped regex 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 2 written, 2 total Time: <> -Ran all test suites matching /snapshotEscapeRegex.js/i. +Ran all test suites matching /snapshotEscapeRegex.js/i." `; exports[`Snapshot works with escaped regex 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 2 passed, 2 total Time: <> -Ran all test suites matching /snapshotEscapeRegex.js/i. +Ran all test suites matching /snapshotEscapeRegex.js/i." `; exports[`Snapshot works with template literal substitutions 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 written, 1 total Time: <> -Ran all test suites matching /snapshotEscapeSubstitution.test.js/i. +Ran all test suites matching /snapshotEscapeSubstitution.test.js/i." `; exports[`Snapshot works with template literal substitutions 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 passed, 1 total Time: <> -Ran all test suites matching /snapshotEscapeSubstitution.test.js/i. +Ran all test suites matching /snapshotEscapeSubstitution.test.js/i." `; diff --git a/e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap b/e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap index b179fed14a23..0b187ca45889 100644 --- a/e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap +++ b/e2e/__tests__/__snapshots__/snapshotMockFs.test.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`store snapshot even if fs is mocked 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 written, 1 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap b/e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap index cc4cb7ebee4b..0bac5f419d34 100644 --- a/e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap +++ b/e2e/__tests__/__snapshots__/snapshotSerializers.test.ts.snap @@ -4,19 +4,19 @@ exports[`Snapshot serializers renders snapshot 1`] = ` Object { "snapshot serializers works with array of strings in property matcher 1": " Object { - \\"arrayOfStrings\\": Array [ - \\"stream\\", + "arrayOfStrings": Array [ + "stream", ], } ", "snapshot serializers works with default serializers 1": "
", "snapshot serializers works with expect.XXX within array in property matcher 1": " Object { - \\"arrayOfStrings\\": Array [ + "arrayOfStrings": Array [ Any, ], } @@ -27,7 +27,7 @@ Object {
> -Ran all test suites matching /testError.test.js/i. +Ran all test suites matching /testError.test.js/i." `; exports[`Stack Trace does not print a stack trace for matching errors when --noStackTrace is given 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /stackTrace.test.js/i. +Ran all test suites matching /stackTrace.test.js/i." `; exports[`Stack Trace does not print a stack trace for runtime errors when --noStackTrace is given 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites matching /runtimeError.test.js/i. +Ran all test suites matching /runtimeError.test.js/i." `; exports[`Stack Trace prints a stack trace for errors 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 3 failed, 3 total Snapshots: 0 total Time: <> -Ran all test suites matching /testError.test.js/i. +Ran all test suites matching /testError.test.js/i." `; exports[`Stack Trace prints a stack trace for errors without message in stack trace 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /stackTraceWithoutMessage.test.js/i. +Ran all test suites matching /stackTraceWithoutMessage.test.js/i." `; exports[`Stack Trace prints a stack trace for matching errors 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites matching /stackTrace.test.js/i. +Ran all test suites matching /stackTrace.test.js/i." `; exports[`Stack Trace prints a stack trace for runtime errors 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: <> -Ran all test suites matching /runtimeError.test.js/i. +Ran all test suites matching /runtimeError.test.js/i." `; diff --git a/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap b/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap index b7f778ea242d..8ea50879d980 100644 --- a/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap +++ b/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`processes stack traces and code frames with source maps with coverage 1`] = ` -FAIL __tests__/fails.ts +"FAIL __tests__/fails.ts ✕ fails ● fails @@ -16,5 +16,5 @@ FAIL __tests__/fails.ts 16 | at Object.error (lib.ts:14:9) - at Object. (__tests__/fails.ts:10:3) + at Object. (__tests__/fails.ts:10:3)" `; diff --git a/e2e/__tests__/__snapshots__/testEnvironmentRunScript.test.ts.snap b/e2e/__tests__/__snapshots__/testEnvironmentRunScript.test.ts.snap index 87e8e5590d01..f8ffc93cbaa8 100644 --- a/e2e/__tests__/__snapshots__/testEnvironmentRunScript.test.ts.snap +++ b/e2e/__tests__/__snapshots__/testEnvironmentRunScript.test.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`throw error if test env does not have getVmContext 1`] = `"Test environment found at \\"/EnvUsingRunScript.js\\" does not export a \\"getVmContext\\" method, which is mandatory from Jest 27. This method is a replacement for \\"runScript\\"."`; +exports[`throw error if test env does not have getVmContext 1`] = `"Test environment found at "/EnvUsingRunScript.js" does not export a "getVmContext" method, which is mandatory from Jest 27. This method is a replacement for "runScript"."`; diff --git a/e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap b/e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap index ecd6203ccb9c..9c72df9c12dd 100644 --- a/e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap +++ b/e2e/__tests__/__snapshots__/testNamePattern.test.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`testNamePattern 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 3 skipped, 2 passed, 5 total Snapshots: 0 total Time: <> -Ran all test suites with tests matching "should match". +Ran all test suites with tests matching "should match"." `; diff --git a/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap b/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap index 6e7747e519cb..fb6226de5485 100644 --- a/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap +++ b/e2e/__tests__/__snapshots__/testNamePatternSkipped.test.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`testNamePattern skipped 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 skipped, 1 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites with tests matching "false". +Ran all test suites with tests matching "false"." `; diff --git a/e2e/__tests__/__snapshots__/testTodo.test.ts.snap b/e2e/__tests__/__snapshots__/testTodo.test.ts.snap index 55e5653336c8..223f73fe35e8 100644 --- a/e2e/__tests__/__snapshots__/testTodo.test.ts.snap +++ b/e2e/__tests__/__snapshots__/testTodo.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`shows error messages when called with invalid argument 1`] = ` -FAIL __tests__/todoNonString.test.js +"FAIL __tests__/todoNonString.test.js ● Test suite failed to run Todo must be called with only a description. @@ -12,11 +12,11 @@ FAIL __tests__/todoNonString.test.js | ^ 9 | - at Object.todo (__tests__/todoNonString.test.js:8:4) + at Object.todo (__tests__/todoNonString.test.js:8:4)" `; exports[`shows error messages when called with multiple arguments 1`] = ` -FAIL __tests__/todoMultipleArgs.test.js +"FAIL __tests__/todoMultipleArgs.test.js ● Test suite failed to run Todo must be called with only a description. @@ -27,11 +27,11 @@ FAIL __tests__/todoMultipleArgs.test.js | ^ 9 | - at Object.todo (__tests__/todoMultipleArgs.test.js:8:4) + at Object.todo (__tests__/todoMultipleArgs.test.js:8:4)" `; exports[`shows error messages when called with no arguments 1`] = ` -FAIL __tests__/todoNoArgs.test.js +"FAIL __tests__/todoNoArgs.test.js ● Test suite failed to run Todo must be called with only a description. @@ -42,19 +42,19 @@ FAIL __tests__/todoNoArgs.test.js | ^ 9 | - at Object.todo (__tests__/todoNoArgs.test.js:8:4) + at Object.todo (__tests__/todoNoArgs.test.js:8:4)" `; exports[`shows todo messages when in verbose mode 1`] = ` -PASS __tests__/verbose.test.js +"PASS __tests__/verbose.test.js todos in verbose reporter ✎ todo this ✎ todo should - ✎ todo work + ✎ todo work" `; exports[`works with all statuses 1`] = ` -FAIL __tests__/statuses.test.js +"FAIL __tests__/statuses.test.js ✓ passes ✕ fails ○ skipped skips @@ -75,5 +75,5 @@ FAIL __tests__/statuses.test.js 15 | 16 | it.skip('skips', () => { - at Object.toBe (__tests__/statuses.test.js:13:14) + at Object.toBe (__tests__/statuses.test.js:13:14)" `; diff --git a/e2e/__tests__/__snapshots__/timeouts.test.ts.snap b/e2e/__tests__/__snapshots__/timeouts.test.ts.snap index 4a2e6ad2faba..45abed912e71 100644 --- a/e2e/__tests__/__snapshots__/timeouts.test.ts.snap +++ b/e2e/__tests__/__snapshots__/timeouts.test.ts.snap @@ -1,43 +1,43 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`does not exceed the command line testTimeout 1`] = ` -PASS __tests__/a-banana.js - ✓ banana +"PASS __tests__/a-banana.js + ✓ banana" `; exports[`does not exceed the command line testTimeout 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`does not exceed the timeout 1`] = ` -PASS __tests__/a-banana.js - ✓ banana +"PASS __tests__/a-banana.js + ✓ banana" `; exports[`does not exceed the timeout 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`exceeds the command line testTimeout 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`exceeds the timeout 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap b/e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap index e6434396d6f1..1f76f9f4b47f 100644 --- a/e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap +++ b/e2e/__tests__/__snapshots__/timeoutsLegacy.test.ts.snap @@ -1,30 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`can read and write jasmine.DEFAULT_TIMEOUT_INTERVAL 1`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`does not exceed the timeout using jasmine.DEFAULT_TIMEOUT_INTERVAL 1`] = ` -PASS __tests__/a-banana.js - ✓ banana +"PASS __tests__/a-banana.js + ✓ banana" `; exports[`does not exceed the timeout using jasmine.DEFAULT_TIMEOUT_INTERVAL 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`exceeds the timeout set using jasmine.DEFAULT_TIMEOUT_INTERVAL 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap b/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap index 4fbfd82ce35a..e813e9a3a502 100644 --- a/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/toMatchInlineSnapshot.test.ts.snap @@ -1,46 +1,46 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`basic support: initial write 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect({apple: 'original value'}).toMatchInlineSnapshot(\` Object { "apple": "original value", } \`)); - +" `; exports[`basic support: snapshot mismatch 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect({apple: 'updated value'}).toMatchInlineSnapshot(\` Object { "apple": "original value", } -\`)); +\`));" `; exports[`basic support: snapshot passed 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect({apple: 'original value'}).toMatchInlineSnapshot(\` Object { "apple": "original value", } \`)); - +" `; exports[`basic support: snapshot updated 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect({apple: 'updated value'}).toMatchInlineSnapshot(\` Object { "apple": "updated value", } \`)); - +" `; exports[`do not indent empty lines: initial write 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect(\`hello world\`).toMatchInlineSnapshot(\` @@ -48,11 +48,11 @@ world\`).toMatchInlineSnapshot(\` world" \`)); - +" `; exports[`do not indent empty lines: snapshot passed 1`] = ` -test('inline snapshots', () => +"test('inline snapshots', () => expect(\`hello world\`).toMatchInlineSnapshot(\` @@ -60,11 +60,11 @@ world\`).toMatchInlineSnapshot(\` world" \`)); - +" `; exports[`handles property matchers: initial write 1`] = ` -test('handles property matchers', () => { +"test('handles property matchers', () => { expect({createdAt: new Date()}).toMatchInlineSnapshot( {createdAt: expect.any(Date)}, \` @@ -74,11 +74,11 @@ test('handles property matchers', () => { \`, ); }); - +" `; exports[`handles property matchers: snapshot failed 1`] = ` -test('handles property matchers', () => { +"test('handles property matchers', () => { expect({createdAt: "string"}).toMatchInlineSnapshot( {createdAt: expect.any(Date)}, \` @@ -87,11 +87,11 @@ expect({createdAt: "string"}).toMatchInlineSnapshot( } \`, ); -}); +});" `; exports[`handles property matchers: snapshot passed 1`] = ` -test('handles property matchers', () => { +"test('handles property matchers', () => { expect({createdAt: new Date()}).toMatchInlineSnapshot( {createdAt: expect.any(Date)}, \` @@ -101,11 +101,11 @@ test('handles property matchers', () => { \`, ); }); - +" `; exports[`handles property matchers: snapshot updated 1`] = ` -test('handles property matchers', () => { +"test('handles property matchers', () => { expect({createdAt: 'string'}).toMatchInlineSnapshot( {createdAt: expect.any(String)}, \` @@ -115,11 +115,11 @@ test('handles property matchers', () => { \`, ); }); - +" `; exports[`indentation is correct in the presences of existing snapshots, when the file is correctly formatted by prettier: existing snapshot 1`] = ` -it('is true', () => { +"it('is true', () => { expect(true).toMatchInlineSnapshot(\`true\`); expect([1, 2, 3]).toMatchInlineSnapshot(\` Array [ @@ -129,11 +129,11 @@ it('is true', () => { ] \`); }); - +" `; exports[`indentation is correct in the presences of existing snapshots: existing snapshot 1`] = ` -test('existing snapshot', () => { +"test('existing snapshot', () => { expect({hello: 'world'}).toMatchInlineSnapshot(\` Object { "hello": "world", @@ -145,11 +145,11 @@ test('existing snapshot', () => { } \`); }); - +" `; exports[`multiple custom matchers and native matchers: multiple matchers 1`] = ` -const {toMatchInlineSnapshot} = require('jest-snapshot'); +"const {toMatchInlineSnapshot} = require('jest-snapshot'); expect.extend({ toMatchCustomInlineSnapshot(received, ...args) { return toMatchInlineSnapshot.call(this, received, ...args); @@ -180,49 +180,49 @@ test('inline snapshots', () => { } \`); }); - +" `; exports[`removes obsolete external snapshots: external snapshot cleaned 1`] = ` -test('removes obsolete external snapshots', () => { +"test('removes obsolete external snapshots', () => { expect('1').toMatchInlineSnapshot(\`"1"\`); }); - +" `; exports[`removes obsolete external snapshots: initial write 1`] = ` -test('removes obsolete external snapshots', () => { +"test('removes obsolete external snapshots', () => { expect('1').toMatchSnapshot(); -}); +});" `; exports[`removes obsolete external snapshots: inline snapshot written 1`] = ` -test('removes obsolete external snapshots', () => { +"test('removes obsolete external snapshots', () => { expect('1').toMatchInlineSnapshot(\`"1"\`); }); - +" `; exports[`supports async matchers 1`] = ` -test('inline snapshots', async () => { +"test('inline snapshots', async () => { expect(Promise.resolve('success')).resolves.toMatchInlineSnapshot( \`"success"\`, ); expect(Promise.reject('fail')).rejects.toMatchInlineSnapshot(\`"fail"\`); }); - +" `; exports[`supports async tests 1`] = ` -test('inline snapshots', async () => { +"test('inline snapshots', async () => { await 'next tick'; expect(42).toMatchInlineSnapshot(\`42\`); }); - +" `; exports[`supports custom matchers with property matcher: custom matchers with property matcher 1`] = ` -const {toMatchInlineSnapshot} = require('jest-snapshot'); +"const {toMatchInlineSnapshot} = require('jest-snapshot'); expect.extend({ toMatchCustomInlineSnapshot(received, ...args) { return toMatchInlineSnapshot.call(this, received, ...args); @@ -266,11 +266,11 @@ test('inline snapshots', () => { } \`); }); - +" `; exports[`supports custom matchers: custom matchers 1`] = ` -const {toMatchInlineSnapshot} = require('jest-snapshot'); +"const {toMatchInlineSnapshot} = require('jest-snapshot'); expect.extend({ toMatchCustomInlineSnapshot(received, ...args) { return toMatchInlineSnapshot.call(this, received, ...args); @@ -283,16 +283,16 @@ test('inline snapshots', () => { } \`); }); - +" `; exports[`writes snapshots with non-literals in expect(...) 1`] = ` -it('works with inline snapshots', () => { +"it('works with inline snapshots', () => { expect({a: 1}).toMatchInlineSnapshot(\` Object { "a": 1, } \`); }); - +" `; diff --git a/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap b/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap index 7e68215ed3f3..c7e0123f5ee3 100644 --- a/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/toThrowErrorMatchingInlineSnapshot.test.ts.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should support rejecting promises 1`] = ` -test('should support rejecting promises', async () => { +"test('should support rejecting promises', async () => { await expect( Promise.reject(new Error('octopus')), ).rejects.toThrowErrorMatchingInlineSnapshot(\`"octopus"\`); }); - +" `; exports[`updates existing snapshot: updated snapshot 1`] = ` -test('updates existing snapshot', () => { +"test('updates existing snapshot', () => { expect(() => { throw new Error('apple'); }).toThrowErrorMatchingInlineSnapshot(\`"apple"\`); }); - +" `; exports[`works fine when function throws error: initial write 1`] = ` -test('works fine when function throws error', () => { +"test('works fine when function throws error', () => { expect(() => { throw new Error('apple'); }).toThrowErrorMatchingInlineSnapshot(\`"apple"\`); }); - +" `; diff --git a/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap b/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap index 5cab09df743f..64d6ace559bd 100644 --- a/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/toThrowErrorMatchingSnapshot.test.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should support rejecting promises 1`] = ` -// Jest Snapshot v1, https://goo.gl/fbAQLP +"// Jest Snapshot v1, https://goo.gl/fbAQLP exports[\`should support rejecting promises 1\`] = \`"octopus"\`; - +" `; diff --git a/e2e/__tests__/__snapshots__/transform.test.ts.snap b/e2e/__tests__/__snapshots__/transform.test.ts.snap index c2c46c8f8105..12dfa3f38bec 100644 --- a/e2e/__tests__/__snapshots__/transform.test.ts.snap +++ b/e2e/__tests__/__snapshots__/transform.test.ts.snap @@ -1,45 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`babel-jest ignored tells user to match ignored files 1`] = ` -FAIL __tests__/ignoredFile.test.js +"FAIL __tests__/ignoredFile.test.js ● Test suite failed to run babel-jest: Babel ignores __tests__/ignoredFile.test.js - make sure to include the file in Jest's transformIgnorePatterns as well. - at assertLoadedBabelConfig (../../../packages/babel-jest/build/index.js:130:11) + at assertLoadedBabelConfig (../../../packages/babel-jest/build/index.js:130:11)" `; exports[`babel-jest instruments only specific files and collects coverage 1`] = ` -------------|---------|----------|---------|---------|------------------- +"------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- All files | 83.33 | 100 | 50 | 80 | covered.js | 83.33 | 100 | 50 | 80 | 13 -------------|---------|----------|---------|---------|------------------- +------------|---------|----------|---------|---------|-------------------" `; exports[`custom transformer instruments files 1`] = ` -----------|---------|----------|---------|---------|------------------- +"----------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- All files | 0 | 0 | 0 | 0 | -----------|---------|----------|---------|---------|------------------- +----------|---------|----------|---------|---------|-------------------" `; exports[`no babel-jest instrumentation with no babel-jest 1`] = ` -------------|---------|----------|---------|---------|------------------- +"------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- All files | 83.33 | 100 | 50 | 80 | covered.js | 83.33 | 100 | 50 | 80 | 13 -------------|---------|----------|---------|---------|------------------- +------------|---------|----------|---------|---------|-------------------" `; exports[`transformer-config instruments only specific files and collects coverage 1`] = ` -------------|---------|----------|---------|---------|------------------- +"------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- All files | 83.33 | 100 | 50 | 80 | Covered.js | 83.33 | 100 | 50 | 80 | 13 -------------|---------|----------|---------|---------|------------------- +------------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap b/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap index 98190d64a6d6..4af96ddc8ee1 100644 --- a/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap +++ b/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`instruments and collects coverage for typescript files 1`] = ` -------------|---------|----------|---------|---------|------------------- +"------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | covered.ts | 100 | 100 | 100 | 100 | -------------|---------|----------|---------|---------|------------------- +------------|---------|----------|---------|---------|-------------------" `; diff --git a/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap b/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap index ee4cd32571a0..1eb721361319 100644 --- a/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`can press "f" to run only failed tests: test results 1`] = ` -FAIL __tests__/bar.spec.js +"FAIL __tests__/bar.spec.js ● bar 1 expect(received).toBe(expected) // Object.is equality @@ -14,11 +14,11 @@ FAIL __tests__/bar.spec.js at Object.toBe (__tests__/bar.spec.js:1:37) -PASS __tests__/foo.spec.js +PASS __tests__/foo.spec.js" `; exports[`can press "f" to run only failed tests: test results 2`] = ` -FAIL __tests__/bar.spec.js +"FAIL __tests__/bar.spec.js ✕ bar 1 ● bar 1 @@ -31,21 +31,21 @@ FAIL __tests__/bar.spec.js > 1 | test('bar 1', () => { expect('bar').toBe('foo'); }); | ^ - at Object.toBe (__tests__/bar.spec.js:1:37) + at Object.toBe (__tests__/bar.spec.js:1:37)" `; exports[`can press "f" to run only failed tests: test summary 1`] = ` -Test Suites: 1 failed, 1 passed, 2 total +"Test Suites: 1 failed, 1 passed, 2 total Tests: 1 failed, 1 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`can press "f" to run only failed tests: test summary 2`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap b/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap index c21bdb00cd2d..64c805df8b1c 100644 --- a/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap @@ -16,30 +16,30 @@ Pattern Mode Usage `; exports[`can press "p" to filter by file name: test results 1`] = ` -PASS __tests__/bar.spec.js -PASS __tests__/foo.spec.js +"PASS __tests__/bar.spec.js +PASS __tests__/foo.spec.js" `; exports[`can press "p" to filter by file name: test results 2`] = ` -PASS __tests__/bar.spec.js +"PASS __tests__/bar.spec.js ✓ bar 1 - ✓ bar 2 + ✓ bar 2" `; exports[`can press "p" to filter by file name: test summary 1`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 4 passed, 4 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`can press "p" to filter by file name: test summary 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 2 passed, 2 total Snapshots: 0 total Time: <> -Ran all test suites matching /bar/i. +Ran all test suites matching /bar/i." `; exports[`can press "t" to filter by test name 1`] = ` @@ -56,27 +56,27 @@ Pattern Mode Usage `; exports[`can press "t" to filter by test name: test results 1`] = ` -PASS __tests__/bar.spec.js -PASS __tests__/foo.spec.js +"PASS __tests__/bar.spec.js +PASS __tests__/foo.spec.js" `; exports[`can press "t" to filter by test name: test results 2`] = ` -PASS __tests__/bar.spec.js -PASS __tests__/foo.spec.js +"PASS __tests__/bar.spec.js +PASS __tests__/foo.spec.js" `; exports[`can press "t" to filter by test name: test summary 1`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 4 passed, 4 total Snapshots: 0 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`can press "t" to filter by test name: test summary 2`] = ` -Test Suites: 2 passed, 2 total +"Test Suites: 2 passed, 2 total Tests: 2 skipped, 2 passed, 4 total Snapshots: 0 total Time: <> -Ran all test suites with tests matching "2". +Ran all test suites with tests matching "2"." `; diff --git a/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap b/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap index 6120e194f5b5..f13279f7e2b1 100644 --- a/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`can press "u" to update snapshots: test results 1`] = ` -FAIL __tests__/bar.spec.js +"FAIL __tests__/bar.spec.js ✕ bar ● bar @@ -20,30 +20,30 @@ FAIL __tests__/bar.spec.js › 1 snapshot failed. Snapshot Summary - › 1 snapshot failed from 1 test suite. Inspect your code changes or press \`u\` to update them. + › 1 snapshot failed from 1 test suite. Inspect your code changes or press \`u\` to update them." `; exports[`can press "u" to update snapshots: test results 2`] = ` -PASS __tests__/bar.spec.js +"PASS __tests__/bar.spec.js ✓ bar › 1 snapshot updated. Snapshot Summary - › 1 snapshot updated from 1 test suite. + › 1 snapshot updated from 1 test suite." `; exports[`can press "u" to update snapshots: test summary 1`] = ` -Test Suites: 1 failed, 1 total +"Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 1 failed, 1 total Time: <> -Ran all test suites. +Ran all test suites." `; exports[`can press "u" to update snapshots: test summary 2`] = ` -Test Suites: 1 passed, 1 total +"Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 1 updated, 1 total Time: <> -Ran all test suites. +Ran all test suites." `; diff --git a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap index fae81fd74c3b..e8f4df3c52a8 100644 --- a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap +++ b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Wrong globals for environment print useful error for document 1`] = ` -FAIL __tests__/node.js +"FAIL __tests__/node.js ✕ use document ○ skipped use window ○ skipped use navigator @@ -21,11 +21,11 @@ FAIL __tests__/node.js 18 | console.log(div); 19 | - at Object.document (__tests__/node.js:16:15) + at Object.document (__tests__/node.js:16:15)" `; exports[`Wrong globals for environment print useful error for navigator 1`] = ` -FAIL __tests__/node.js +"FAIL __tests__/node.js ✕ use navigator ○ skipped use document ○ skipped use window @@ -45,11 +45,11 @@ FAIL __tests__/node.js 34 | console.log(userAgent); 35 | - at Object.navigator (__tests__/node.js:32:21) + at Object.navigator (__tests__/node.js:32:21)" `; exports[`Wrong globals for environment print useful error for unref 1`] = ` -FAIL __tests__/jsdom.js +"FAIL __tests__/jsdom.js ✕ use unref ● use unref @@ -67,11 +67,11 @@ FAIL __tests__/jsdom.js 15 | expect(1).toBe(1); 16 | }); - at Object.unref (__tests__/jsdom.js:13:27) + at Object.unref (__tests__/jsdom.js:13:27)" `; exports[`Wrong globals for environment print useful error for window 1`] = ` -FAIL __tests__/node.js +"FAIL __tests__/node.js ✕ use window ○ skipped use document ○ skipped use navigator @@ -91,11 +91,11 @@ FAIL __tests__/node.js 26 | console.log(location); 27 | - at Object.window (__tests__/node.js:24:20) + at Object.window (__tests__/node.js:24:20)" `; exports[`Wrong globals for environment print useful error when it explodes during evaluation 1`] = ` -FAIL __tests__/beforeTest.js +"FAIL __tests__/beforeTest.js ● Test suite failed to run The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string. @@ -111,5 +111,5 @@ FAIL __tests__/beforeTest.js 15 | console.log(div); 16 | - at Object.document (__tests__/beforeTest.js:13:13) + at Object.document (__tests__/beforeTest.js:13:13)" `; diff --git a/e2e/__tests__/asyncAndCallback.test.ts b/e2e/__tests__/asyncAndCallback.test.ts index 76cb059cc551..45926424f574 100644 --- a/e2e/__tests__/asyncAndCallback.test.ts +++ b/e2e/__tests__/asyncAndCallback.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJasmine} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -16,6 +15,6 @@ test('errors when a test both returns a promise and takes a callback', () => { const result = runJest('promise-and-callback'); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(result.exitCode).toBe(1); }); diff --git a/e2e/__tests__/beforeAllFiltered.ts b/e2e/__tests__/beforeAllFiltered.ts index 7d0a5cf4fbc5..037ccf4cffb9 100644 --- a/e2e/__tests__/beforeAllFiltered.ts +++ b/e2e/__tests__/beforeAllFiltered.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; describe('Correct BeforeAll run', () => { @@ -15,6 +14,6 @@ describe('Correct BeforeAll run', () => { // for some reason Circus does not have the `Object` part stdout = stdout.replace(/at Object.log \(/g, 'at log ('); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/beforeEachQueue.ts b/e2e/__tests__/beforeEachQueue.ts index 2b6ed2d4968a..cfa0505d33f4 100644 --- a/e2e/__tests__/beforeEachQueue.ts +++ b/e2e/__tests__/beforeEachQueue.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJestCircus} from '@jest/test-utils'; import runJest from '../runJest'; @@ -14,6 +13,6 @@ skipSuiteOnJestCircus(); // Circus does not support funky async definitions describe('Correct beforeEach order', () => { it('ensures the correct order for beforeEach', () => { const result = runJest('before-each-queue'); - expect(wrap(result.stdout.replace(/\\/g, '/'))).toMatchSnapshot(); + expect(result.stdout.replace(/\\/g, '/')).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/callDoneTwice.test.ts b/e2e/__tests__/callDoneTwice.test.ts index 10d84ffc1ddf..0093d0f769a7 100644 --- a/e2e/__tests__/callDoneTwice.test.ts +++ b/e2e/__tests__/callDoneTwice.test.ts @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; + import {skipSuiteOnJasmine} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -13,6 +13,6 @@ skipSuiteOnJasmine(); test('`done()` should not be called more than once', () => { const {exitCode, stderr} = runJest('call-done-twice'); const {rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(exitCode).toBe(1); }); diff --git a/e2e/__tests__/chaiAssertionLibrary.ts b/e2e/__tests__/chaiAssertionLibrary.ts index 8d7b77d0086f..61de6d1fce19 100644 --- a/e2e/__tests__/chaiAssertionLibrary.ts +++ b/e2e/__tests__/chaiAssertionLibrary.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -16,5 +15,5 @@ test('chai assertion errors should display properly', () => { const {stderr} = runJest('chai-assertion-library-errors'); const {rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/circularInequality.test.ts b/e2e/__tests__/circularInequality.test.ts index a74ef44df19c..8e5747cc5821 100644 --- a/e2e/__tests__/circularInequality.test.ts +++ b/e2e/__tests__/circularInequality.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import { cleanup, createEmptyPackage, @@ -53,6 +52,6 @@ test.skip('handles circular inequality properly', async () => { const {stderr} = await end(); const {summary, rest} = extractSortedSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); diff --git a/e2e/__tests__/circusDeclarationErrors.test.ts b/e2e/__tests__/circusDeclarationErrors.test.ts index 667b1742b4f5..7a72da80657a 100644 --- a/e2e/__tests__/circusDeclarationErrors.test.ts +++ b/e2e/__tests__/circusDeclarationErrors.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJasmine} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -20,5 +19,5 @@ it('defining tests and hooks asynchronously throws', () => { expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/cliHandlesExactFilenames.test.ts b/e2e/__tests__/cliHandlesExactFilenames.test.ts index 7e773cbd8475..fc71933e63d4 100644 --- a/e2e/__tests__/cliHandlesExactFilenames.test.ts +++ b/e2e/__tests__/cliHandlesExactFilenames.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -31,8 +30,8 @@ test('CLI accepts exact file names if matchers matched', () => { result.stderr.replace('\\\\foo\\\\bar', '\\/foo\\/bar'), ); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(result.stdout).toBe(''); }); diff --git a/e2e/__tests__/console.test.ts b/e2e/__tests__/console.test.ts index 0030d2a4eff1..a93104fcf0c6 100644 --- a/e2e/__tests__/console.test.ts +++ b/e2e/__tests__/console.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -15,8 +14,8 @@ test('console printing', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('console printing with --verbose', () => { @@ -27,9 +26,9 @@ test('console printing with --verbose', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('does not print to console with --silent', () => { @@ -45,9 +44,9 @@ test('does not print to console with --silent', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('respects --noStackTrace', () => { @@ -63,9 +62,9 @@ test('respects --noStackTrace', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('respects noStackTrace in config', () => { @@ -81,9 +80,9 @@ test('respects noStackTrace in config', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); // issue: https://github.com/facebook/jest/issues/5223 @@ -92,9 +91,9 @@ test('the jsdom console is the same as the test console', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('does not error out when using winston', () => { @@ -104,7 +103,7 @@ test('does not error out when using winston', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); diff --git a/e2e/__tests__/consoleAfterTeardown.test.ts b/e2e/__tests__/consoleAfterTeardown.test.ts index 6f6d2e111381..a6108d4a4362 100644 --- a/e2e/__tests__/consoleAfterTeardown.test.ts +++ b/e2e/__tests__/consoleAfterTeardown.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -17,5 +16,5 @@ test('console printing', () => { const withoutTrace = rest.split('\n').slice(0, -3).join('\n'); - expect(wrap(withoutTrace)).toMatchSnapshot(); + expect(withoutTrace).toMatchSnapshot(); }); diff --git a/e2e/__tests__/consoleDebugging.test.ts b/e2e/__tests__/consoleDebugging.test.ts index 4aca32566208..b766554e98ba 100644 --- a/e2e/__tests__/consoleDebugging.test.ts +++ b/e2e/__tests__/consoleDebugging.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -17,7 +16,7 @@ test('console debugging with --verbose', () => { const {summary, rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); diff --git a/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts b/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts index 3e505c906365..227e94f83e5a 100644 --- a/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts +++ b/e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -46,7 +45,7 @@ test('prints console.logs when run with forceExit', () => { } expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); - expect(wrap(stdout)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/e2e/__tests__/coverageHandlebars.test.ts b/e2e/__tests__/coverageHandlebars.test.ts index 3a1cf3be05c7..7ede9d431580 100644 --- a/e2e/__tests__/coverageHandlebars.test.ts +++ b/e2e/__tests__/coverageHandlebars.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import {readFileSync} from 'graceful-fs'; -import wrap from 'jest-snapshot-serializer-raw'; import {cleanup, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -23,7 +22,7 @@ it('code coverage for Handlebars', () => { const result = runJest(dir, ['--coverage', '--no-cache']); expect(result.exitCode).toBe(0); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); const coverageMapFile = path.join(coverageDir, 'coverage-final.json'); const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf-8')); diff --git a/e2e/__tests__/coverageProviderV8.test.ts b/e2e/__tests__/coverageProviderV8.test.ts index 523ff071f99a..e0aed23d0d10 100644 --- a/e2e/__tests__/coverageProviderV8.test.ts +++ b/e2e/__tests__/coverageProviderV8.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import wrap from 'jest-snapshot-serializer-raw'; import {onNodeVersions} from '@jest/test-utils'; import runJest from '../runJest'; @@ -22,7 +21,7 @@ test('prints coverage with missing sourcemaps', () => { ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('prints coverage with empty sourcemaps', () => { @@ -35,7 +34,7 @@ test('prints coverage with empty sourcemaps', () => { ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('prints correct coverage report, if a CJS module is put under test without transformation', () => { @@ -48,7 +47,7 @@ test('prints correct coverage report, if a CJS module is put under test without ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('prints correct coverage report, if a TS module is transpiled by Babel to CJS and put under test', () => { @@ -61,7 +60,7 @@ test('prints correct coverage report, if a TS module is transpiled by Babel to C ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); // The versions where vm.Module exists and commonjs with "exports" is not broken @@ -79,7 +78,7 @@ onNodeVersions('>=12.16.0', () => { ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('prints correct coverage report, if a TS module is transpiled by custom transformer to ESM put under test', () => { @@ -95,6 +94,6 @@ onNodeVersions('>=12.16.0', () => { ); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/coverageReport.test.ts b/e2e/__tests__/coverageReport.test.ts index b268c60d2d16..f5954d002229 100644 --- a/e2e/__tests__/coverageReport.test.ts +++ b/e2e/__tests__/coverageReport.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -28,7 +27,7 @@ test('outputs coverage report', () => { // is listed with 0 % coverage. // - `notRequiredInTestSuite.js` is not required but it is listed // with 0 % coverage. - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(() => fs.accessSync(coverageDir, fs.constants.F_OK)).not.toThrow(); expect(exitCode).toBe(0); @@ -47,7 +46,7 @@ test('collects coverage only from specified file', () => { ); // Coverage report should only have `file.js` coverage info - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('collects coverage only from multiple specified files', () => { @@ -64,7 +63,7 @@ test('collects coverage only from multiple specified files', () => { {stripAnsi: true}, ); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('collects coverage only from specified files avoiding dependencies', () => { @@ -82,7 +81,7 @@ test('collects coverage only from specified files avoiding dependencies', () => ); // Coverage report should only have `sum.js` coverage info - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('json reporter printing with --coverage', () => { @@ -91,7 +90,7 @@ test('json reporter printing with --coverage', () => { }); const {summary} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('outputs coverage report as json', () => { @@ -117,7 +116,7 @@ test('outputs coverage report when text is requested', () => { ); expect(exitCode).toBe(0); expect(stdout).toMatch(/Stmts | . Branch/); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('outputs coverage report when text-summary is requested', () => { @@ -128,7 +127,7 @@ test('outputs coverage report when text-summary is requested', () => { ); expect(exitCode).toBe(0); expect(stdout).toMatch(/Coverage summary/); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('outputs coverage report when text and text-summary is requested', () => { @@ -145,7 +144,7 @@ test('outputs coverage report when text and text-summary is requested', () => { expect(exitCode).toBe(0); expect(stdout).toMatch(/Stmts | . Branch/); expect(stdout).toMatch(/Coverage summary/); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('does not output coverage report when html is requested', () => { @@ -156,7 +155,7 @@ test('does not output coverage report when html is requested', () => { ); expect(exitCode).toBe(0); expect(stdout).toMatch(/^$/); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('collects coverage from duplicate files avoiding shared cache', () => { @@ -177,7 +176,7 @@ test('collects coverage from duplicate files avoiding shared cache', () => { // Run for the second time const {stdout, exitCode} = runJest(DIR, args, {stripAnsi: true}); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -187,6 +186,6 @@ test('generates coverage when using the testRegex config param ', () => { '--testRegex=__tests__', '--coverage', ]); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/coverageThreshold.test.ts b/e2e/__tests__/coverageThreshold.test.ts index b0bc9436f093..52776ed786b5 100644 --- a/e2e/__tests__/coverageThreshold.test.ts +++ b/e2e/__tests__/coverageThreshold.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -49,9 +48,9 @@ test('exits with 1 if coverage threshold is not met', () => { const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); - expect(wrap(stdout)).toMatchSnapshot('stdout'); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); + expect(stdout).toMatchSnapshot('stdout'); }); test('exits with 1 if path threshold group is not found in coverage data', () => { @@ -88,9 +87,9 @@ test('exits with 1 if path threshold group is not found in coverage data', () => const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); - expect(wrap(stdout)).toMatchSnapshot('stdout'); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); + expect(stdout).toMatchSnapshot('stdout'); }); test('exits with 0 if global threshold group is not found in coverage data', () => { @@ -127,7 +126,7 @@ test('exits with 0 if global threshold group is not found in coverage data', () }); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot('stdout'); + expect(stdout).toMatchSnapshot('stdout'); }); test('excludes tests matched by path threshold groups from global group', () => { @@ -172,9 +171,9 @@ test('excludes tests matched by path threshold groups from global group', () => const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); - expect(wrap(stdout)).toMatchSnapshot('stdout'); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); + expect(stdout).toMatchSnapshot('stdout'); }); test('file is matched by all path and glob threshold groups', () => { @@ -224,7 +223,7 @@ test('file is matched by all path and glob threshold groups', () => { ); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); - expect(wrap(stdout)).toMatchSnapshot('stdout'); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); + expect(stdout).toMatchSnapshot('stdout'); }); diff --git a/e2e/__tests__/coverageWithoutTransform.test.ts b/e2e/__tests__/coverageWithoutTransform.test.ts index 200c330f39cf..dcccab3407c7 100644 --- a/e2e/__tests__/coverageWithoutTransform.test.ts +++ b/e2e/__tests__/coverageWithoutTransform.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup} from '../Utils'; import runJest from '../runJest'; @@ -25,5 +24,5 @@ it('produces code coverage for uncovered files without transformer', () => { const {exitCode, stdout} = runJest(dir, ['--coverage', '--no-cache']); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/e2e/__tests__/crawlSymlinks.test.ts b/e2e/__tests__/crawlSymlinks.test.ts index f09fe7f39001..50e87efd4060 100644 --- a/e2e/__tests__/crawlSymlinks.test.ts +++ b/e2e/__tests__/crawlSymlinks.test.ts @@ -6,7 +6,6 @@ */ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, writeFiles, writeSymlinks} from '../Utils'; import runJest from '../runJest'; @@ -73,12 +72,12 @@ test('Should throw if watchman used with haste.enableSymlinks', () => { const {exitCode, stderr, stdout} = run1; expect(stdout).toEqual(''); - expect(wrap(stderr)).toMatchInlineSnapshot(` - Validation Error: + expect(stderr).toMatchInlineSnapshot(` + "Validation Error: haste.enableSymlinks is incompatible with watchman - Either set haste.enableSymlinks to false or do not use watchman + Either set haste.enableSymlinks to false or do not use watchman" `); expect(exitCode).toEqual(1); }); diff --git a/e2e/__tests__/customInlineSnapshotMatchers.test.ts b/e2e/__tests__/customInlineSnapshotMatchers.test.ts index c6f5234f8533..8e1254d09b6a 100644 --- a/e2e/__tests__/customInlineSnapshotMatchers.test.ts +++ b/e2e/__tests__/customInlineSnapshotMatchers.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -23,7 +22,7 @@ test('works with custom inline snapshot matchers', () => { .filter(line => line.indexOf('at Error (native)') < 0) .join('\n'); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('can bail with a custom inline snapshot matcher', () => { @@ -40,5 +39,5 @@ test('can bail with a custom inline snapshot matcher', () => { .filter(line => line.indexOf('at Error (native)') < 0) .join('\n'); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/customMatcherStackTrace.test.ts b/e2e/__tests__/customMatcherStackTrace.test.ts index 5d33a5b39b41..b0268f3a9bcc 100644 --- a/e2e/__tests__/customMatcherStackTrace.test.ts +++ b/e2e/__tests__/customMatcherStackTrace.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -19,7 +18,7 @@ test('works with custom matchers', () => { .filter(line => line.indexOf('at Error (native)') < 0) .join('\n'); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('custom async matchers', () => { @@ -29,5 +28,5 @@ test('custom async matchers', () => { const {rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/customReporters.test.ts b/e2e/__tests__/customReporters.test.ts index e5a5cf3508aa..8fcda1d509ad 100644 --- a/e2e/__tests__/customReporters.test.ts +++ b/e2e/__tests__/customReporters.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {onNodeVersions} from '@jest/test-utils'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -45,7 +44,7 @@ describe('Custom Reporters Integration', () => { 'add.test.js', ]); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -61,7 +60,7 @@ describe('Custom Reporters Integration', () => { ]); expect(exitCode).toBe(1); - expect(wrap(stderr)).toMatchSnapshot(); + expect(stderr).toMatchSnapshot(); }); test('default reporters enabled', () => { @@ -77,8 +76,8 @@ describe('Custom Reporters Integration', () => { const parsedJSON = JSON.parse(stdout); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(parsedJSON).toMatchSnapshot(); }); @@ -119,7 +118,7 @@ describe('Custom Reporters Integration', () => { expect(exitCode).toBe(0); expect(stderr).toBe(''); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('reporters can be default exports', () => { @@ -134,7 +133,7 @@ describe('Custom Reporters Integration', () => { expect(stderr).toBe(''); expect(exitCode).toBe(0); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('prints reporter errors', () => { diff --git a/e2e/__tests__/declarationErrors.test.ts b/e2e/__tests__/declarationErrors.test.ts index c35c62c6ae9f..3c7f67a5d2de 100644 --- a/e2e/__tests__/declarationErrors.test.ts +++ b/e2e/__tests__/declarationErrors.test.ts @@ -5,23 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; const extractMessage = (str: string) => - wrap( - extractSummary(str) - .rest.replace( - // circus-jasmine normalization - /.+addSpecsToSuite (.+:\d+:\d+).+\n/g, - '', - ) - .match( - // all lines from the first to the last mentioned "describe" after the "●" line - /●(.|\n)*?\n(?.*describe((.|\n)*describe)*.*)(\n|$)/imu, - )?.groups?.lines ?? '', - ); + extractSummary(str) + .rest.replace( + // circus-jasmine normalization + /.+addSpecsToSuite (.+:\d+:\d+).+\n/g, + '', + ) + .match( + // all lines from the first to the last mentioned "describe" after the "●" line + /●(.|\n)*?\n(?.*describe((.|\n)*describe)*.*)(\n|$)/imu, + )?.groups?.lines ?? ''; it('errors if describe returns a Promise', () => { const result = runJest('declaration-errors', [ diff --git a/e2e/__tests__/detectOpenHandles.ts b/e2e/__tests__/detectOpenHandles.ts index 714b64f441ca..971ef1d69d09 100644 --- a/e2e/__tests__/detectOpenHandles.ts +++ b/e2e/__tests__/detectOpenHandles.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {onNodeVersions} from '@jest/test-utils'; import runJest, {runContinuous} from '../runJest'; @@ -36,7 +35,7 @@ it('prints message about flag on slow tests', async () => { const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('prints message about flag on forceExit', async () => { @@ -45,7 +44,7 @@ it('prints message about flag on forceExit', async () => { const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('prints out info about open handlers', async () => { @@ -57,7 +56,7 @@ it('prints out info about open handlers', async () => { const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('does not report promises', () => { @@ -132,7 +131,7 @@ it('prints out info about open handlers from inside tests', async () => { const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('prints out info about open handlers from tests with a `done` callback', async () => { @@ -144,7 +143,7 @@ it('prints out info about open handlers from tests with a `done` callback', asyn const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('prints out info about open handlers from lifecycle functions with a `done` callback', async () => { @@ -164,7 +163,7 @@ it('prints out info about open handlers from lifecycle functions with a `done` c 'at setTimeout', ); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); it('does not print info about open handlers for a server that is already closed', async () => { @@ -176,5 +175,5 @@ it('does not print info about open handlers for a server that is already closed' const {stderr} = await run.end(); const textAfterTest = getTextAfterTest(stderr); - expect(wrap(textAfterTest)).toMatchSnapshot(); + expect(textAfterTest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/each.test.ts b/e2e/__tests__/each.test.ts index f65e74bdff04..2dcfcad1152f 100644 --- a/e2e/__tests__/each.test.ts +++ b/e2e/__tests__/each.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -21,7 +20,7 @@ test('shows error message when not enough arguments are supplied to tests', () = const result = runJest(dir, ['eachException.test.js']); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows the correct errors in stderr when failing tests', () => { @@ -31,33 +30,33 @@ test('shows the correct errors in stderr when failing tests', () => { .rest.split('\n') .map(line => line.trimRight()) .join('\n'); - expect(wrap(output)).toMatchSnapshot(); + expect(output).toMatchSnapshot(); }); test('shows only the tests with .only as being ran', () => { const result = runJest(dir, ['eachOnly.test.js']); expect(result.exitCode).toBe(0); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows only the tests without .skip as being ran', () => { const result = runJest(dir, ['eachSkip.test.js']); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); test('runs only the describe.only.each tests', () => { const result = runJest(dir, ['describeOnly.test.js']); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); test('formats args with pretty format when given %p', () => { const result = runJest(dir, ['pretty.test.js']); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); diff --git a/e2e/__tests__/environmentAfterTeardown.test.ts b/e2e/__tests__/environmentAfterTeardown.test.ts index 2056db34491c..103e33d1d43c 100644 --- a/e2e/__tests__/environmentAfterTeardown.test.ts +++ b/e2e/__tests__/environmentAfterTeardown.test.ts @@ -5,14 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; 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(wrap(interestingLines)).toMatchSnapshot(); + 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__/errorOnDeprecated.test.ts b/e2e/__tests__/errorOnDeprecated.test.ts index e0d2f1d28e4c..82069e754f62 100644 --- a/e2e/__tests__/errorOnDeprecated.test.ts +++ b/e2e/__tests__/errorOnDeprecated.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJestCircus} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -57,7 +56,7 @@ testFiles.forEach(testFile => { ); } - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/executeTestsOnceInMpr.ts b/e2e/__tests__/executeTestsOnceInMpr.ts index 20f4346c51d3..e65f1d43f10c 100644 --- a/e2e/__tests__/executeTestsOnceInMpr.ts +++ b/e2e/__tests__/executeTestsOnceInMpr.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -55,6 +54,6 @@ test('Tests are executed only once even in an MPR', () => { // We have only one test passed, so total should equal to one, despite we have // three projects. - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); expect(summary).toMatch(/1 total/); }); diff --git a/e2e/__tests__/expectAsyncMatcher.test.ts b/e2e/__tests__/expectAsyncMatcher.test.ts index f9b19723dcd5..5602bad3bdc7 100644 --- a/e2e/__tests__/expectAsyncMatcher.test.ts +++ b/e2e/__tests__/expectAsyncMatcher.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -31,5 +30,5 @@ test('shows the correct errors in stderr when failing tests', () => { .filter(line => line.indexOf('packages/expect/build/index.js') === -1) .join('\n'); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/failureDetailsProperty.test.ts b/e2e/__tests__/failureDetailsProperty.test.ts index 59dac9a63ef0..05dcc677cb81 100644 --- a/e2e/__tests__/failureDetailsProperty.test.ts +++ b/e2e/__tests__/failureDetailsProperty.test.ts @@ -91,12 +91,12 @@ test('that the failureDetails property is set', () => { "error": Object { "matcherResult": Object { "actual": "Object { - \\"p1\\": \\"hello\\", - \\"p2\\": \\"world\\", + "p1": "hello", + "p2": "world", }", "expected": "Object { - \\"p1\\": \\"hello\\", - \\"p2\\": \\"sunshine\\", + "p1": "hello", + "p2": "sunshine", }", "message": "expect(received).toMatchInlineSnapshot(snapshot) @@ -106,9 +106,9 @@ test('that the failureDetails property is set', () => { + Received + 1 Object { - \\"p1\\": \\"hello\\", - - \\"p2\\": \\"sunshine\\", - + \\"p2\\": \\"world\\", + "p1": "hello", + - "p2": "sunshine", + + "p2": "world", }", "name": "toMatchInlineSnapshot", "pass": false, @@ -124,9 +124,9 @@ test('that the failureDetails property is set', () => { + Received + 1 Object { - \\"p1\\": \\"hello\\", - - \\"p2\\": \\"sunshine\\", - + \\"p2\\": \\"world\\", + "p1": "hello", + - "p2": "sunshine", + + "p2": "world", }", "passed": false, "stack": "Error: expect(received).toMatchInlineSnapshot(snapshot) @@ -137,9 +137,9 @@ test('that the failureDetails property is set', () => { + Received + 1 Object { - \\"p1\\": \\"hello\\", - - \\"p2\\": \\"sunshine\\", - + \\"p2\\": \\"world\\", + "p1": "hello", + - "p2": "sunshine", + + "p2": "world", } at ", }, @@ -216,12 +216,12 @@ test('that the failureDetails property is set', () => { Object { "matcherResult": Object { "actual": "Object { - \\"p1\\": \\"hello\\", - \\"p2\\": \\"world\\", + "p1": "hello", + "p2": "world", }", "expected": "Object { - \\"p1\\": \\"hello\\", - \\"p2\\": \\"sunshine\\", + "p1": "hello", + "p2": "sunshine", }", "message": "expect(received).toMatchInlineSnapshot(snapshot) @@ -231,9 +231,9 @@ test('that the failureDetails property is set', () => { + Received + 1 Object { - \\"p1\\": \\"hello\\", - - \\"p2\\": \\"sunshine\\", - + \\"p2\\": \\"world\\", + "p1": "hello", + - "p2": "sunshine", + + "p2": "world", }", "name": "toMatchInlineSnapshot", "pass": false, diff --git a/e2e/__tests__/failures.test.ts b/e2e/__tests__/failures.test.ts index 48c96cc974b3..98153dcd1011 100644 --- a/e2e/__tests__/failures.test.ts +++ b/e2e/__tests__/failures.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -30,13 +29,13 @@ beforeAll(() => { test('not throwing Error objects', () => { let stderr; stderr = runJest(dir, ['throwNumber.test.js']).stderr; - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); stderr = runJest(dir, ['throwString.test.js']).stderr; - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); stderr = runJest(dir, ['throwObject.test.js']).stderr; - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); stderr = runJest(dir, ['assertionCount.test.js']).stderr; - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); stderr = runJest(dir, ['duringTests.test.js']).stderr; if (nodeMajorVersion < 12) { @@ -50,22 +49,22 @@ test('not throwing Error objects', () => { ); } - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); stderr = runJest(dir, ['throwObjectWithStackProp.test.js']).stderr; - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); }); test('works with node assert', () => { const {stderr} = runJest(dir, ['assertionError.test.js']); const summary = normalizeDots(cleanStderr(stderr)); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('works with assertions in separate files', () => { const {stderr} = runJest(dir, ['testMacro.test.js']); - expect(wrap(normalizeDots(cleanStderr(stderr)))).toMatchSnapshot(); + expect(normalizeDots(cleanStderr(stderr))).toMatchSnapshot(); }); test('works with async failures', () => { @@ -82,7 +81,7 @@ test('works with async failures', () => { .replace(/.*Use jest\.setTimeout\(newTimeout\).*/, '') .replace(/.*Timeout - Async callback was not.*/, ''); - expect(wrap(result)).toMatchSnapshot(); + expect(result).toMatchSnapshot(); }); test('works with snapshot failures', () => { @@ -91,7 +90,7 @@ test('works with snapshot failures', () => { const result = normalizeDots(cleanStderr(stderr)); expect( - wrap(result.substring(0, result.indexOf('Snapshot Summary'))), + result.substring(0, result.indexOf('Snapshot Summary')), ).toMatchSnapshot(); }); @@ -101,7 +100,7 @@ test('works with snapshot failures with hint', () => { const result = normalizeDots(cleanStderr(stderr)); expect( - wrap(result.substring(0, result.indexOf('Snapshot Summary'))), + result.substring(0, result.indexOf('Snapshot Summary')), ).toMatchSnapshot(); }); diff --git a/e2e/__tests__/findRelatedFiles.test.ts b/e2e/__tests__/findRelatedFiles.test.ts index 7fc3b678426b..5d298ce2e9f3 100644 --- a/e2e/__tests__/findRelatedFiles.test.ts +++ b/e2e/__tests__/findRelatedFiles.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -143,19 +142,17 @@ describe('--findRelatedTests flag', () => { let summary; let rest; ({summary, rest} = extractSummary(stderr)); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect( - wrap( - rest - .split('\n') - .map(s => s.trim()) - .sort() - .join('\n'), - ), + rest + .split('\n') + .map(s => s.trim()) + .sort() + .join('\n'), ).toMatchSnapshot(); // both a.js and b.js should be in the coverage - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); ({stdout, stderr} = runJest(DIR, ['--findRelatedTests', 'a.js'], { stripAnsi: true, @@ -163,11 +160,11 @@ describe('--findRelatedTests flag', () => { ({summary, rest} = extractSummary(stderr)); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); // should only run a.js - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); // coverage should be collected only for a.js - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('coverage configuration is applied correctly', () => { @@ -195,19 +192,17 @@ describe('--findRelatedTests flag', () => { })); const {summary, rest} = extractSummary(stderr); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect( - wrap( - rest - .split('\n') - .map(s => s.trim()) - .sort() - .join('\n'), - ), + rest + .split('\n') + .map(s => s.trim()) + .sort() + .join('\n'), ).toMatchSnapshot(); // Only a.js should be in the report - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(stdout).toMatch('a.js'); expect(stdout).not.toMatch('b.js'); diff --git a/e2e/__tests__/globals.test.ts b/e2e/__tests__/globals.test.ts index dc75ecf893b0..b90315cdb732 100644 --- a/e2e/__tests__/globals.test.ts +++ b/e2e/__tests__/globals.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import { cleanup, createEmptyPackage, @@ -47,8 +46,8 @@ test('basic test constructs', () => { const {stderr, exitCode} = runJest(DIR); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -85,8 +84,8 @@ test('interleaved describe and test children order', () => { const {stderr, exitCode} = runJest(DIR); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -116,8 +115,8 @@ test('skips', () => { const {stderr, exitCode} = runJest(DIR); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -146,8 +145,8 @@ test('only', () => { const {stderr, exitCode} = runJest(DIR); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -163,8 +162,8 @@ test('cannot have describe with no implementation', () => { const rest = cleanStderr(stderr); const {summary} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -180,8 +179,8 @@ test('cannot test with no implementation', () => { const {stderr, exitCode} = runJest(DIR); const {summary} = extractSummary(stderr); - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -211,8 +210,8 @@ test('skips with expand arg', () => { const {stderr, exitCode} = runJest(DIR, ['--expand']); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -241,8 +240,8 @@ test('only with expand arg', () => { const {stderr, exitCode} = runJest(DIR, ['--expand']); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -258,8 +257,8 @@ test('cannot test with no implementation with expand arg', () => { const {stderr, exitCode} = runJest(DIR, ['--expand']); const {summary} = extractSummary(stderr); - expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(cleanStderr(stderr)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -276,7 +275,7 @@ test('function as descriptor', () => { const {stderr, exitCode} = runJest(DIR); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/injectGlobals.test.ts b/e2e/__tests__/injectGlobals.test.ts index 8649cd23e92e..141a5e84b429 100644 --- a/e2e/__tests__/injectGlobals.test.ts +++ b/e2e/__tests__/injectGlobals.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJasmine} from '@jest/test-utils'; import { cleanup, @@ -50,8 +49,8 @@ test.each` const {json, stderr, exitCode} = runJest(DIR, args); const {summary, rest} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); expect(json.numPassedTests).toBe(1); }); diff --git a/e2e/__tests__/jest.config.js.test.ts b/e2e/__tests__/jest.config.js.test.ts index 82129fc5fca1..4e1a6ff8f561 100644 --- a/e2e/__tests__/jest.config.js.test.ts +++ b/e2e/__tests__/jest.config.js.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -25,8 +24,8 @@ test('works with jest.config.js', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('traverses directory tree up until it finds jest.config', () => { @@ -48,14 +47,12 @@ test('traverses directory tree up until it finds jest.config', () => { ); // Snapshot the console.loged `process.cwd()` and make sure it stays the same - expect( - wrap(stdout.replace(/^\W+(.*)e2e/gm, '<>')), - ).toMatchSnapshot(); + expect(stdout.replace(/^\W+(.*)e2e/gm, '<>')).toMatchSnapshot(); const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('invalid JS in jest.config.js', () => { diff --git a/e2e/__tests__/jest.config.ts.test.ts b/e2e/__tests__/jest.config.ts.test.ts index 7792c8612d0b..96599050bb98 100644 --- a/e2e/__tests__/jest.config.ts.test.ts +++ b/e2e/__tests__/jest.config.ts.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -25,8 +24,8 @@ test('works with jest.config.ts', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('works with tsconfig.json', () => { @@ -40,8 +39,8 @@ test('works with tsconfig.json', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('traverses directory tree up until it finds jest.config', () => { @@ -63,14 +62,12 @@ test('traverses directory tree up until it finds jest.config', () => { ); // Snapshot the console.loged `process.cwd()` and make sure it stays the same - expect( - wrap(stdout.replace(/^\W+(.*)e2e/gm, '<>')), - ).toMatchSnapshot(); + expect(stdout.replace(/^\W+(.*)e2e/gm, '<>')).toMatchSnapshot(); const {rest, summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('it does type check the config', () => { diff --git a/e2e/__tests__/listTests.test.ts b/e2e/__tests__/listTests.test.ts index a10bae735eed..4da1bd54f463 100644 --- a/e2e/__tests__/listTests.test.ts +++ b/e2e/__tests__/listTests.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; const testRootDir = path.resolve(__dirname, '..', '..'); @@ -24,7 +23,7 @@ describe('--listTests flag', () => { expect(exitCode).toBe(0); expect( - wrap(normalizePaths(stdout).split('\n').sort().join('\n')), + normalizePaths(stdout).split('\n').sort().join('\n'), ).toMatchSnapshot(); }); @@ -34,7 +33,7 @@ describe('--listTests flag', () => { expect(exitCode).toBe(0); expect(() => JSON.parse(stdout)).not.toThrow(); expect( - wrap(JSON.stringify(JSON.parse(stdout).map(normalizePaths).sort())), + JSON.stringify(JSON.parse(stdout).map(normalizePaths).sort()), ).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/moduleNameMapper.test.ts b/e2e/__tests__/moduleNameMapper.test.ts index 447970a9727d..c71d59edcf70 100644 --- a/e2e/__tests__/moduleNameMapper.test.ts +++ b/e2e/__tests__/moduleNameMapper.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest, {json as runWithJson} from '../runJest'; @@ -14,7 +13,7 @@ test('moduleNameMapper wrong configuration', () => { const {rest} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('moduleNameMapper wrong array configuration', () => { @@ -22,7 +21,7 @@ test('moduleNameMapper wrong array configuration', () => { const {rest} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('moduleNameMapper correct configuration', () => { @@ -32,7 +31,7 @@ test('moduleNameMapper correct configuration', () => { const {rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('moduleNameMapper correct configuration mocking module of absolute path', () => { @@ -46,7 +45,7 @@ test('moduleNameMapper correct configuration mocking module of absolute path', ( const {rest} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('moduleNameMapper with mocking', () => { diff --git a/e2e/__tests__/multiProjectRunner.test.ts b/e2e/__tests__/multiProjectRunner.test.ts index ba4d129e00c1..6c0dcd6a4147 100644 --- a/e2e/__tests__/multiProjectRunner.test.ts +++ b/e2e/__tests__/multiProjectRunner.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, sortLines, writeFiles} from '../Utils'; import runJest, {getConfig} from '../runJest'; @@ -87,7 +86,7 @@ test('can pass projects or global config', () => { 'The name `file1` was looked up in the Haste module map. It cannot be resolved, because there exists several different files', ); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); writeFiles(DIR, { 'global_config.js': ` @@ -112,8 +111,8 @@ test('can pass projects or global config', () => { ])); const result1 = extractSummary(stderr); - expect(wrap(result1.summary)).toMatchSnapshot(); - expect(wrap(sortLines(result1.rest))).toMatchSnapshot(); + expect(result1.summary).toMatchSnapshot(); + expect(sortLines(result1.rest)).toMatchSnapshot(); ({stderr} = runJest(DIR, [ '--no-watchman', @@ -123,8 +122,8 @@ test('can pass projects or global config', () => { ])); const result2 = extractSummary(stderr); - expect(wrap(result2.summary)).toMatchSnapshot(); - expect(wrap(sortLines(result2.rest))).toMatchSnapshot(); + expect(result2.summary).toMatchSnapshot(); + expect(sortLines(result2.rest)).toMatchSnapshot(); // make sure different ways of passing projects work exactly the same expect(result1.summary).toBe(result2.summary); diff --git a/e2e/__tests__/multipleConfigs.ts b/e2e/__tests__/multipleConfigs.ts index 305140510bc3..84644f94a59f 100644 --- a/e2e/__tests__/multipleConfigs.ts +++ b/e2e/__tests__/multipleConfigs.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import slash = require('slash'); import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -25,8 +24,8 @@ test('multiple configs will warn', () => { const cleanStdErr = stderr.replace(new RegExp(rootDir, 'g'), ''); const {rest, summary} = extractSummary(cleanStdErr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); test('multiple configs warning can be suppressed by using --config', () => { diff --git a/e2e/__tests__/nativeEsm.test.ts b/e2e/__tests__/nativeEsm.test.ts index 8aa81dbf1b69..f1e9eed31f07 100644 --- a/e2e/__tests__/nativeEsm.test.ts +++ b/e2e/__tests__/nativeEsm.test.ts @@ -6,7 +6,6 @@ */ import {resolve} from 'path'; -import wrap from 'jest-snapshot-serializer-raw'; import {onNodeVersions} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest, {getConfig} from '../runJest'; @@ -29,7 +28,7 @@ onNodeVersions('>=12.16.0', () => { const {summary} = extractSummary(stderr); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(stdout).toBe(''); expect(exitCode).toBe(0); }); @@ -46,7 +45,7 @@ onNodeVersions('>=14.3.0', () => { const {summary} = extractSummary(stderr); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(stdout).toBe(''); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/nestedTestDefinitions.test.ts b/e2e/__tests__/nestedTestDefinitions.test.ts index adf43115cd76..4559fc279c49 100644 --- a/e2e/__tests__/nestedTestDefinitions.test.ts +++ b/e2e/__tests__/nestedTestDefinitions.test.ts @@ -5,22 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {isJestJasmineRun} from '@jest/test-utils'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; const cleanupRunnerStack = (stderr: string) => - wrap( - stderr - .split('\n') - .filter( - line => - !line.includes('packages/jest-jasmine2/build') && - !line.includes('packages/jest-circus/build'), - ) - .join('\n'), - ); + stderr + .split('\n') + .filter( + line => + !line.includes('packages/jest-jasmine2/build') && + !line.includes('packages/jest-circus/build'), + ) + .join('\n'); test('print correct error message with nested test definitions outside describe', () => { const result = runJest('nested-test-definitions', ['outside']); diff --git a/e2e/__tests__/processExit.test.ts b/e2e/__tests__/processExit.test.ts index d58016722697..ea7c1a9d8d2b 100644 --- a/e2e/__tests__/processExit.test.ts +++ b/e2e/__tests__/processExit.test.ts @@ -5,11 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; it('prints stack trace pointing to process.exit call', () => { const {stderr} = runJest('process-exit'); - expect(wrap(stderr)).toMatchSnapshot(); + expect(stderr).toMatchSnapshot(); }); diff --git a/e2e/__tests__/requireAfterTeardown.test.ts b/e2e/__tests__/requireAfterTeardown.test.ts index c8353dc7ed2b..c7e2b1d3f898 100644 --- a/e2e/__tests__/requireAfterTeardown.test.ts +++ b/e2e/__tests__/requireAfterTeardown.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import runJest from '../runJest'; test('prints useful error for requires after test is done', () => { @@ -13,7 +12,7 @@ test('prints useful error for requires after test is done', () => { const interestingLines = stderr.split('\n').slice(9, 18).join('\n'); - expect(wrap(interestingLines)).toMatchSnapshot(); + expect(interestingLines).toMatchSnapshot(); expect(stderr.split('\n')[19]).toMatch( new RegExp('(__tests__/lateRequire.test.js:11:20)'), ); diff --git a/e2e/__tests__/resolveNoFileExtensions.test.ts b/e2e/__tests__/resolveNoFileExtensions.test.ts index 6ed78161d2df..8681260a6f79 100644 --- a/e2e/__tests__/resolveNoFileExtensions.test.ts +++ b/e2e/__tests__/resolveNoFileExtensions.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -20,7 +19,7 @@ test('show error message with matching files', () => { const {rest} = extractSummary(stderr); expect(exitCode).toBe(1); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('show error message when no js moduleFileExtensions', () => { @@ -47,5 +46,5 @@ test('show error message when no js moduleFileExtensions', () => { const {exitCode, stderr} = runJest('resolve-no-extensions-no-js'); expect(exitCode).toBe(1); - expect(wrap(stderr)).toMatchSnapshot(); + expect(stderr).toMatchSnapshot(); }); diff --git a/e2e/__tests__/runProgrammaticallyMultipleProjects.test.ts b/e2e/__tests__/runProgrammaticallyMultipleProjects.test.ts index 16b3c257949f..df8fddf3ac21 100644 --- a/e2e/__tests__/runProgrammaticallyMultipleProjects.test.ts +++ b/e2e/__tests__/runProgrammaticallyMultipleProjects.test.ts @@ -6,7 +6,6 @@ */ import {resolve} from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import stripAnsi = require('strip-ansi'); import {extractSummary, run} from '../Utils'; @@ -16,5 +15,5 @@ test('run programmatically with multiple projects', () => { const {stderr, exitCode} = run(`node run-jest.js`, dir); const {summary} = extractSummary(stripAnsi(stderr)); expect(exitCode).toEqual(0); - expect(wrap(summary)).toMatchSnapshot('summary'); + expect(summary).toMatchSnapshot('summary'); }); diff --git a/e2e/__tests__/showConfig.test.ts b/e2e/__tests__/showConfig.test.ts index 3505a9f66c37..c852be53e82f 100644 --- a/e2e/__tests__/showConfig.test.ts +++ b/e2e/__tests__/showConfig.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -40,5 +39,5 @@ test('--showConfig outputs config info and exits', () => { .replace(/"\S*show-config-test/gm, '"<>') .replace(/"\S*\/jest\/packages/gm, '"<>'); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/e2e/__tests__/snapshot.test.ts b/e2e/__tests__/snapshot.test.ts index b4c41db5d04e..1be3697f3b3d 100644 --- a/e2e/__tests__/snapshot.test.ts +++ b/e2e/__tests__/snapshot.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest, {json as runWithJson} from '../runJest'; @@ -115,7 +114,7 @@ describe('Snapshot', () => { ).not.toBeUndefined(); expect(stderr).toMatch('5 snapshots written from 2 test suites'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); }); it('works with escaped characters', () => { @@ -129,7 +128,7 @@ describe('Snapshot', () => { expect(stderr).toMatch('1 snapshot written'); expect(result.exitCode).toBe(0); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); // Write the second snapshot const testData = @@ -147,7 +146,7 @@ describe('Snapshot', () => { stderr = result.stderr; expect(stderr).toMatch('1 snapshot written'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(result.exitCode).toBe(0); // Now let's check again if everything still passes. @@ -160,7 +159,7 @@ describe('Snapshot', () => { stderr = result.stderr; expect(stderr).not.toMatch('Snapshot Summary'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); @@ -175,7 +174,7 @@ describe('Snapshot', () => { expect(stderr).toMatch('2 snapshots written from 1 test suite.'); expect(result.exitCode).toBe(0); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); result = runJest('snapshot-escape', [ '-w=1', @@ -187,7 +186,7 @@ describe('Snapshot', () => { // Make sure we aren't writing a snapshot this time which would // indicate that the snapshot couldn't be loaded properly. expect(stderr).not.toMatch('Snapshot Summary'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); @@ -202,7 +201,7 @@ describe('Snapshot', () => { expect(stderr).toMatch('1 snapshot written'); expect(result.exitCode).toBe(0); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); result = runJest('snapshot-escape', [ '-w=1', @@ -214,7 +213,7 @@ describe('Snapshot', () => { // Make sure we aren't writing a snapshot this time which would // indicate that the snapshot couldn't be loaded properly. expect(stderr).not.toMatch('1 snapshot written'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(result.exitCode).toBe(0); }); @@ -233,7 +232,7 @@ describe('Snapshot', () => { const {rest, summary} = extractSummary(result.stderr); expect(rest).toMatch('New snapshot was not written'); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); it('works on subsequent runs without `-u`', () => { @@ -249,8 +248,8 @@ describe('Snapshot', () => { expect(firstRun.stderr).toMatch('9 snapshots written from 3 test suites'); expect(secondRun.stderr).toMatch('9 passed, 9 total'); - expect(wrap(extractSummary(firstRun.stderr).summary)).toMatchSnapshot(); - expect(wrap(extractSummary(secondRun.stderr).summary)).toMatchSnapshot(); + expect(extractSummary(firstRun.stderr).summary).toMatchSnapshot(); + expect(extractSummary(secondRun.stderr).summary).toMatchSnapshot(); }); it('deletes the snapshot if the test suite has been removed', () => { @@ -269,8 +268,8 @@ describe('Snapshot', () => { expect(secondRun.stderr).toMatch( '1 snapshot file removed from 1 test suite', ); - expect(wrap(extractSummary(firstRun.stderr).summary)).toMatchSnapshot(); - expect(wrap(extractSummary(secondRun.stderr).summary)).toMatchSnapshot(); + expect(extractSummary(firstRun.stderr).summary).toMatchSnapshot(); + expect(extractSummary(secondRun.stderr).summary).toMatchSnapshot(); }); it('deletes a snapshot when a test does removes all the snapshots', () => { @@ -288,8 +287,8 @@ describe('Snapshot', () => { expect(secondRun.stderr).toMatch( '1 snapshot file removed from 1 test suite', ); - expect(wrap(extractSummary(firstRun.stderr).summary)).toMatchSnapshot(); - expect(wrap(extractSummary(secondRun.stderr).summary)).toMatchSnapshot(); + expect(extractSummary(firstRun.stderr).summary).toMatchSnapshot(); + expect(extractSummary(secondRun.stderr).summary).toMatchSnapshot(); }); it('updates the snapshot when a test removes some snapshots', () => { @@ -321,10 +320,10 @@ describe('Snapshot', () => { expect(beforeRemovingSnapshot[keyToCheck]).not.toBe(undefined); expect(afterRemovingSnapshot[keyToCheck]).toBe(undefined); - expect(wrap(extractSummary(firstRun.stderr).summary)).toMatchSnapshot(); + expect(extractSummary(firstRun.stderr).summary).toMatchSnapshot(); expect(firstRun.stderr).toMatch('9 snapshots written from 3 test suites'); - expect(wrap(extractSummary(secondRun.stderr).summary)).toMatchSnapshot(); + expect(extractSummary(secondRun.stderr).summary).toMatchSnapshot(); expect(secondRun.stderr).toMatch('1 snapshot updated from 1 test suite'); expect(secondRun.stderr).toMatch('1 snapshot removed from 1 test suite'); }); diff --git a/e2e/__tests__/snapshotMockFs.test.ts b/e2e/__tests__/snapshotMockFs.test.ts index 6b796b4c1b92..299eb9933422 100644 --- a/e2e/__tests__/snapshotMockFs.test.ts +++ b/e2e/__tests__/snapshotMockFs.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import rimraf = require('rimraf'); import {extractSummary} from '../Utils'; import {json as runJestJson} from '../runJest'; @@ -26,7 +25,7 @@ test('store snapshot even if fs is mocked', () => { expect(json.numPassedTests).toBe(1); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); const content = require(snapshotFile); expect(content['snapshot 1']).toBe(` diff --git a/e2e/__tests__/stackTrace.test.ts b/e2e/__tests__/stackTrace.test.ts index b2377c1b601c..4e4a780bd632 100644 --- a/e2e/__tests__/stackTrace.test.ts +++ b/e2e/__tests__/stackTrace.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; @@ -13,7 +12,7 @@ describe('Stack Trace', () => { it('prints a stack trace for runtime errors', () => { const {exitCode, stderr} = runJest('stack-trace', ['runtimeError.test.js']); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).toMatch( @@ -31,7 +30,7 @@ describe('Stack Trace', () => { '--noStackTrace', ]); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).toMatch( @@ -45,7 +44,7 @@ describe('Stack Trace', () => { it('prints a stack trace for matching errors', () => { const {exitCode, stderr} = runJest('stack-trace', ['stackTrace.test.js']); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).toMatch(/\s+at\s(?:.+?)\s\(__tests__\/stackTrace.test\.js/); @@ -57,7 +56,7 @@ describe('Stack Trace', () => { '--noStackTrace', ]); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).not.toMatch( @@ -68,7 +67,7 @@ describe('Stack Trace', () => { it('prints a stack trace for errors', () => { const {exitCode, stderr} = runJest('stack-trace', ['testError.test.js']); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).toMatch(/this is unexpected\./); @@ -91,7 +90,7 @@ describe('Stack Trace', () => { 'stackTraceWithoutMessage.test.js', ]); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).toMatch(/important message/); @@ -106,7 +105,7 @@ describe('Stack Trace', () => { '--noStackTrace', ]); - expect(wrap(extractSummary(stderr).summary)).toMatchSnapshot(); + expect(extractSummary(stderr).summary).toMatchSnapshot(); expect(exitCode).toBe(1); expect(stderr).not.toMatch( diff --git a/e2e/__tests__/stackTraceSourceMapsWithCoverage.test.ts b/e2e/__tests__/stackTraceSourceMapsWithCoverage.test.ts index 192ad7103909..ce042f5c6478 100644 --- a/e2e/__tests__/stackTraceSourceMapsWithCoverage.test.ts +++ b/e2e/__tests__/stackTraceSourceMapsWithCoverage.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ import * as path from 'path'; -import wrap from 'jest-snapshot-serializer-raw'; import {extractSummary, runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -18,5 +17,5 @@ it('processes stack traces and code frames with source maps with coverage', () = const {stderr} = runJest(dir, ['--no-cache', '--coverage']); // Should report an error at source line 13 in lib.ts at line 10 of the test - expect(wrap(extractSummary(stderr).rest)).toMatchSnapshot(); + expect(extractSummary(stderr).rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/testNamePattern.test.ts b/e2e/__tests__/testNamePattern.test.ts index fd17bd4f1e4d..d8004aaede53 100644 --- a/e2e/__tests__/testNamePattern.test.ts +++ b/e2e/__tests__/testNamePattern.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import {json as runWithJson} from '../runJest'; @@ -17,5 +16,5 @@ test('testNamePattern', () => { const {summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); diff --git a/e2e/__tests__/testNamePatternSkipped.test.ts b/e2e/__tests__/testNamePatternSkipped.test.ts index 37e107d8077e..e789e2b3a240 100644 --- a/e2e/__tests__/testNamePatternSkipped.test.ts +++ b/e2e/__tests__/testNamePatternSkipped.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import {json as runWithJson} from '../runJest'; @@ -17,5 +16,5 @@ test('testNamePattern skipped', () => { const {summary} = extractSummary(stderr); expect(exitCode).toBe(0); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); }); diff --git a/e2e/__tests__/testTodo.test.ts b/e2e/__tests__/testTodo.test.ts index 8e7def195543..d1b608227088 100644 --- a/e2e/__tests__/testTodo.test.ts +++ b/e2e/__tests__/testTodo.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; const dir = path.resolve(__dirname, '../test-todo'); @@ -15,33 +14,33 @@ test('works with all statuses', () => { const result = runJest(dir, ['statuses.test.js']); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows error messages when called with no arguments', () => { const result = runJest(dir, ['todoNoArgs.test.js']); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows error messages when called with multiple arguments', () => { const result = runJest(dir, ['todoMultipleArgs.test.js']); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows error messages when called with invalid argument', () => { const result = runJest(dir, ['todoNonString.test.js']); expect(result.exitCode).toBe(1); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); test('shows todo messages when in verbose mode', () => { const result = runJest(dir, ['verbose.test.js', '--verbose']); expect(result.exitCode).toBe(0); const {rest} = extractSummary(result.stderr); - expect(wrap(rest)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); }); diff --git a/e2e/__tests__/timeouts.test.ts b/e2e/__tests__/timeouts.test.ts index 228e1ae33964..0e28573f7185 100644 --- a/e2e/__tests__/timeouts.test.ts +++ b/e2e/__tests__/timeouts.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -34,7 +33,7 @@ test('exceeds the timeout', () => { expect(rest).toMatch( /(jest\.setTimeout|jasmine\.DEFAULT_TIMEOUT_INTERVAL|Exceeded timeout)/, ); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -54,8 +53,8 @@ test('does not exceed the timeout', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {rest, summary} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -81,7 +80,7 @@ test('exceeds the command line testTimeout', () => { expect(rest).toMatch( /(jest\.setTimeout|jasmine\.DEFAULT_TIMEOUT_INTERVAL|Exceeded timeout)/, ); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -104,7 +103,7 @@ test('does not exceed the command line testTimeout', () => { '--testTimeout=1000', ]); const {rest, summary} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/timeoutsLegacy.test.ts b/e2e/__tests__/timeoutsLegacy.test.ts index 5382336d3591..610f10ef1982 100644 --- a/e2e/__tests__/timeoutsLegacy.test.ts +++ b/e2e/__tests__/timeoutsLegacy.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {skipSuiteOnJestCircus} from '@jest/test-utils'; import {cleanup, extractSummary, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -41,7 +40,7 @@ test('exceeds the timeout set using jasmine.DEFAULT_TIMEOUT_INTERVAL', () => { expect(rest).toMatch( /(jest\.setTimeout|jasmine\.DEFAULT_TIMEOUT_INTERVAL|Exceeded timeout)/, ); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(1); }); @@ -61,8 +60,8 @@ test('does not exceed the timeout using jasmine.DEFAULT_TIMEOUT_INTERVAL', () => const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {rest, summary} = extractSummary(stderr); - expect(wrap(rest)).toMatchSnapshot(); - expect(wrap(summary)).toMatchSnapshot(); + expect(rest).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); @@ -83,6 +82,6 @@ test('can read and write jasmine.DEFAULT_TIMEOUT_INTERVAL', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false']); const {summary} = extractSummary(stderr); - expect(wrap(summary)).toMatchSnapshot(); + expect(summary).toMatchSnapshot(); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/toMatchInlineSnapshot.test.ts b/e2e/__tests__/toMatchInlineSnapshot.test.ts index 4ac3db884836..afa81f57a563 100644 --- a/e2e/__tests__/toMatchInlineSnapshot.test.ts +++ b/e2e/__tests__/toMatchInlineSnapshot.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -34,7 +33,7 @@ test('basic support', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('initial write'); + expect(fileAfter).toMatchSnapshot('initial write'); } { @@ -43,7 +42,7 @@ test('basic support', () => { expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(stderr).not.toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot passed'); + expect(fileAfter).toMatchSnapshot('snapshot passed'); } { @@ -54,7 +53,7 @@ test('basic support', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('Snapshot name: `inline snapshots 1`'); expect(exitCode).toBe(1); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot mismatch'); + expect(fileAfter).toMatchSnapshot('snapshot mismatch'); } { @@ -67,7 +66,7 @@ test('basic support', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot updated from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot updated'); + expect(fileAfter).toMatchSnapshot('snapshot updated'); } }); @@ -85,7 +84,7 @@ test('do not indent empty lines', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('initial write'); + expect(fileAfter).toMatchSnapshot('initial write'); } { @@ -94,7 +93,7 @@ test('do not indent empty lines', () => { expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(stderr).not.toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot passed'); + expect(fileAfter).toMatchSnapshot('snapshot passed'); } }); @@ -111,7 +110,7 @@ test('handles property matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('initial write'); + expect(fileAfter).toMatchSnapshot('initial write'); } { @@ -119,7 +118,7 @@ test('handles property matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot passed'); + expect(fileAfter).toMatchSnapshot('snapshot passed'); } { @@ -131,7 +130,7 @@ test('handles property matchers', () => { expect(stderr).toMatch('Snapshot name: `handles property matchers 1`'); expect(stderr).toMatch('Snapshots: 1 failed, 1 total'); expect(exitCode).toBe(1); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot failed'); + expect(fileAfter).toMatchSnapshot('snapshot failed'); } { @@ -147,7 +146,7 @@ test('handles property matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot updated from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('snapshot updated'); + expect(fileAfter).toMatchSnapshot('snapshot updated'); } }); @@ -170,7 +169,7 @@ test('removes obsolete external snapshots', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('initial write'); + expect(fileAfter).toMatchSnapshot('initial write'); expect(fs.existsSync(snapshotPath)).toEqual(true); } @@ -180,7 +179,7 @@ test('removes obsolete external snapshots', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('Snapshots: 1 obsolete, 1 written, 1 total'); expect(exitCode).toBe(1); - expect(wrap(fileAfter)).toMatchSnapshot('inline snapshot written'); + expect(fileAfter).toMatchSnapshot('inline snapshot written'); expect(fs.existsSync(snapshotPath)).toEqual(true); } @@ -194,7 +193,7 @@ test('removes obsolete external snapshots', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('Snapshots: 1 file removed, 1 passed, 1 total'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('external snapshot cleaned'); + expect(fileAfter).toMatchSnapshot('external snapshot cleaned'); expect(fs.existsSync(snapshotPath)).toEqual(false); } }); @@ -213,7 +212,7 @@ test('supports async matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('2 snapshots written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot(); + expect(fileAfter).toMatchSnapshot(); }); test('supports async tests', () => { @@ -230,7 +229,7 @@ test('supports async tests', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot(); + expect(fileAfter).toMatchSnapshot(); }); test('writes snapshots with non-literals in expect(...)', () => { @@ -247,7 +246,7 @@ test('writes snapshots with non-literals in expect(...)', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot(); + expect(fileAfter).toMatchSnapshot(); }); // issue: https://github.com/facebook/jest/issues/6702 @@ -287,7 +286,7 @@ test('supports custom matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('custom matchers'); + expect(fileAfter).toMatchSnapshot('custom matchers'); }); test('supports custom matchers with property matcher', () => { @@ -329,9 +328,7 @@ test('supports custom matchers with property matcher', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('2 snapshots written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot( - 'custom matchers with property matcher', - ); + expect(fileAfter).toMatchSnapshot('custom matchers with property matcher'); }); test('multiple custom matchers and native matchers', () => { @@ -359,7 +356,7 @@ test('multiple custom matchers and native matchers', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('4 snapshots written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('multiple matchers'); + expect(fileAfter).toMatchSnapshot('multiple matchers'); }); test('indentation is correct in the presences of existing snapshots', () => { @@ -380,7 +377,7 @@ test('indentation is correct in the presences of existing snapshots', () => { const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('existing snapshot'); + expect(fileAfter).toMatchSnapshot('existing snapshot'); }); test('indentation is correct in the presences of existing snapshots, when the file is correctly formatted by prettier', () => { @@ -397,5 +394,5 @@ test('indentation is correct in the presences of existing snapshots, when the fi const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); expect(exitCode).toBe(0); - expect(wrap(fileAfter)).toMatchSnapshot('existing snapshot'); + expect(fileAfter).toMatchSnapshot('existing snapshot'); }); diff --git a/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts b/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts index da2f419b46c6..7c8b92738e69 100644 --- a/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts +++ b/e2e/__tests__/toThrowErrorMatchingInlineSnapshot.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -39,7 +38,7 @@ test('works fine when function throws error', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); - expect(wrap(fileAfter)).toMatchSnapshot('initial write'); + expect(fileAfter).toMatchSnapshot('initial write'); expect(exitCode).toBe(0); } }); @@ -65,7 +64,7 @@ test('updates existing snapshot', () => { ]); const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot updated from 1 test suite.'); - expect(wrap(fileAfter)).toMatchSnapshot('updated snapshot'); + expect(fileAfter).toMatchSnapshot('updated snapshot'); expect(exitCode).toBe(0); } }); @@ -101,6 +100,6 @@ test('should support rejecting promises', () => { const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); const fileAfter = readFile(filename); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); - expect(wrap(fileAfter)).toMatchSnapshot(); + expect(fileAfter).toMatchSnapshot(); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts b/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts index 4ff08cc5f4f3..799e0071bb55 100644 --- a/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts +++ b/e2e/__tests__/toThrowErrorMatchingSnapshot.test.ts @@ -7,7 +7,6 @@ import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -101,7 +100,7 @@ test('should support rejecting promises', () => { ); expect(stderr).toMatch('1 snapshot written from 1 test suite.'); - expect(wrap(snapshot)).toMatchSnapshot(); + expect(snapshot).toMatchSnapshot(); expect(exitCode).toBe(0); } }); diff --git a/e2e/__tests__/transform.test.ts b/e2e/__tests__/transform.test.ts index 2d2e67c7ce2e..7580cfbce565 100644 --- a/e2e/__tests__/transform.test.ts +++ b/e2e/__tests__/transform.test.ts @@ -8,7 +8,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; import * as fs from 'graceful-fs'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {onNodeVersions} from '@jest/test-utils'; import { cleanup, @@ -42,7 +41,7 @@ describe('babel-jest', () => { expect(stdout).not.toMatch('notCovered.js'); expect(stdout).not.toMatch('excludedFromCoverage.js'); // coverage result should not change - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); }); @@ -53,7 +52,7 @@ describe('babel-jest ignored', () => { // --no-cache because babel can cache stuff and result in false green const {exitCode, stderr} = runJest(dir, ['--no-cache']); expect(exitCode).toBe(1); - expect(wrap(extractSummary(stderr).rest)).toMatchSnapshot(); + expect(extractSummary(stderr).rest).toMatchSnapshot(); }); }); @@ -101,7 +100,7 @@ describe('no babel-jest', () => { expect(stdout).toMatch('covered.js'); expect(stdout).not.toMatch('excludedFromCoverage.js'); // coverage result should not change - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); }); @@ -126,7 +125,7 @@ describe('custom transformer', () => { stripAnsi: true, }); // coverage should be empty because there's no real instrumentation - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); expect(exitCode).toBe(0); }); }); @@ -184,7 +183,7 @@ describe('transformer-config', () => { expect(stdout).not.toMatch('NotCovered.js'); expect(stdout).not.toMatch('ExcludedFromCoverage.js'); // coverage result should not change - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/typescriptCoverage.test.ts b/e2e/__tests__/typescriptCoverage.test.ts index f22e76c209f1..060dd5ce89c8 100644 --- a/e2e/__tests__/typescriptCoverage.test.ts +++ b/e2e/__tests__/typescriptCoverage.test.ts @@ -6,7 +6,6 @@ */ import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {runYarnInstall} from '../Utils'; import runJest from '../runJest'; @@ -16,5 +15,5 @@ it('instruments and collects coverage for typescript files', () => { const {stdout} = runJest(dir, ['--coverage', '--no-cache'], { stripAnsi: true, }); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/e2e/__tests__/watchModeOnlyFailed.test.ts b/e2e/__tests__/watchModeOnlyFailed.test.ts index 2462c571d0d8..3cdbab6514e9 100644 --- a/e2e/__tests__/watchModeOnlyFailed.test.ts +++ b/e2e/__tests__/watchModeOnlyFailed.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummaries, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -18,7 +17,7 @@ beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); expect.addSnapshotSerializer({ - print: val => val.replace(/\[s\[u/g, '\n'), + print: val => (val as string).replace(/\[s\[u/g, '\n'), test: val => typeof val === 'string' && val.includes('[s'), }); @@ -48,8 +47,8 @@ test('can press "f" to run only failed tests', () => { expect(results).toHaveLength(2); results.forEach(({rest, summary}) => { - expect(wrap(rest)).toMatchSnapshot('test results'); - expect(wrap(summary)).toMatchSnapshot('test summary'); + expect(rest).toMatchSnapshot('test results'); + expect(summary).toMatchSnapshot('test summary'); }); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/watchModePatterns.test.ts b/e2e/__tests__/watchModePatterns.test.ts index 6a635bc68472..7361a5f426ea 100644 --- a/e2e/__tests__/watchModePatterns.test.ts +++ b/e2e/__tests__/watchModePatterns.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummaries, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -18,7 +17,7 @@ beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); expect.addSnapshotSerializer({ - print: val => val.replace(/\[s\[u/g, '\n'), + print: val => (val as string).replace(/\[s\[u/g, '\n'), test: val => typeof val === 'string' && val.includes('[s'), }); @@ -51,12 +50,11 @@ test('can press "p" to filter by file name', () => { ]); const results = extractSummaries(stderr); - // contains ansi characters, should not use `wrap` expect(stdout).toMatchSnapshot(); expect(results).toHaveLength(2); results.forEach(({rest, summary}) => { - expect(wrap(rest)).toMatchSnapshot('test results'); - expect(wrap(summary)).toMatchSnapshot('test summary'); + expect(rest).toMatchSnapshot('test results'); + expect(summary).toMatchSnapshot('test summary'); }); expect(exitCode).toBe(0); }); @@ -71,12 +69,11 @@ test('can press "t" to filter by test name', () => { ]); const results = extractSummaries(stderr); - // contains ansi characters, should not use `wrap` expect(stdout).toMatchSnapshot(); expect(results).toHaveLength(2); results.forEach(({rest, summary}) => { - expect(wrap(rest)).toMatchSnapshot('test results'); - expect(wrap(summary)).toMatchSnapshot('test summary'); + expect(rest).toMatchSnapshot('test results'); + expect(summary).toMatchSnapshot('test summary'); }); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/watchModeUpdateSnapshot.test.ts b/e2e/__tests__/watchModeUpdateSnapshot.test.ts index a779d23086fe..d843d99c46cf 100644 --- a/e2e/__tests__/watchModeUpdateSnapshot.test.ts +++ b/e2e/__tests__/watchModeUpdateSnapshot.test.ts @@ -7,7 +7,6 @@ import {tmpdir} from 'os'; import * as path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import {cleanup, extractSummaries, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -18,7 +17,7 @@ beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); expect.addSnapshotSerializer({ - print: val => val.replace(/\[s\[u/g, '\n'), + print: val => (val as string).replace(/\[s\[u/g, '\n'), test: val => typeof val === 'string' && val.includes('[s'), }); @@ -48,8 +47,8 @@ test('can press "u" to update snapshots', () => { const results = extractSummaries(stderr); expect(results).toHaveLength(2); results.forEach(({rest, summary}) => { - expect(wrap(rest)).toMatchSnapshot('test results'); - expect(wrap(summary)).toMatchSnapshot('test summary'); + expect(rest).toMatchSnapshot('test results'); + expect(summary).toMatchSnapshot('test summary'); }); expect(exitCode).toBe(0); }); diff --git a/e2e/__tests__/wrongEnv.test.ts b/e2e/__tests__/wrongEnv.test.ts index e2b0c184c8c4..b6e140099929 100644 --- a/e2e/__tests__/wrongEnv.test.ts +++ b/e2e/__tests__/wrongEnv.test.ts @@ -5,14 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {extractSummary} from '../Utils'; import runJest from '../runJest'; function assertFailuresAndSnapshot(args: Array) { const result = runJest('wrong-env', args); expect(result.exitCode).toBe(1); - expect(wrap(extractSummary(result.stderr).rest)).toMatchSnapshot(); + expect(extractSummary(result.stderr).rest).toMatchSnapshot(); } describe('Wrong globals for environment', () => { diff --git a/jest.config.js b/jest.config.js index 18d69b645a78..98103ffa7447 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,7 @@ 'use strict'; +/** @type import('@jest/types').Config.InitialOptions */ module.exports = { collectCoverageFrom: [ '**/packages/*/**/*.js', @@ -30,9 +31,11 @@ module.exports = { ], projects: ['', '/examples/*/'], setupFilesAfterEnv: ['/testSetupFile.js'], + snapshotFormat: { + escapeString: false, + }, snapshotSerializers: [ '/packages/pretty-format/build/plugins/ConvertAnsi.js', - require.resolve('jest-snapshot-serializer-raw'), ], testPathIgnorePatterns: [ '/__arbitraries__/', diff --git a/package.json b/package.json index 5e728b63aab3..ea3c799d352b 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "jest-runner-tsd": "^2.0.0", "jest-silent-reporter": "^0.5.0", "jest-snapshot": "workspace:*", - "jest-snapshot-serializer-raw": "^1.1.0", "jest-watch-typeahead": "^0.6.0", "jquery": "^3.2.1", "lerna": "^4.0.0", diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index c8bd90ec02d0..d5c05d4ee2e5 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -46,8 +46,7 @@ "@types/graceful-fs": "^4.1.3", "@types/stack-utils": "^2.0.0", "execa": "^5.0.0", - "graceful-fs": "^4.2.9", - "jest-snapshot-serializer-raw": "^1.1.0" + "graceful-fs": "^4.2.9" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.ts.snap b/packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.ts.snap index a5401244fafa..8ae3e7150ae1 100644 --- a/packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.ts.snap +++ b/packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`child tests marked with only should not run if describe block is skipped 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: afterAll add_hook: beforeAll add_test: my test @@ -15,11 +15,11 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`child tests marked with todo should not run if describe block is skipped 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: afterAll add_hook: beforeAll add_test: my test @@ -33,11 +33,11 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`describe block _can_ have hooks if a child describe block has tests 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: afterEach add_hook: beforeEach add_hook: afterAll @@ -72,11 +72,11 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`describe block cannot have hooks and no tests 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: afterEach add_hook: beforeEach add_hook: afterAll @@ -89,11 +89,11 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 4 +unhandledErrors: 4" `; exports[`describe block hooks must not run if describe block is skipped 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: afterAll add_hook: beforeAll add_test: my test @@ -107,7 +107,7 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`tests are not marked done until their parent afterAll runs 1`] = ` diff --git a/packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.ts.snap b/packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.ts.snap index 204360a8a9da..a7e8e0cba778 100644 --- a/packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.ts.snap +++ b/packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`failures 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: beforeEach add_hook: afterEach add_test: one @@ -30,11 +30,11 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`simple test 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: beforeEach add_hook: afterEach add_test: one @@ -63,5 +63,5 @@ run_describe_finish: describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; diff --git a/packages/jest-circus/src/__tests__/__snapshots__/hooks.test.ts.snap b/packages/jest-circus/src/__tests__/__snapshots__/hooks.test.ts.snap index 5a7b8d95e37f..465511f31286 100644 --- a/packages/jest-circus/src/__tests__/__snapshots__/hooks.test.ts.snap +++ b/packages/jest-circus/src/__tests__/__snapshots__/hooks.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`beforeAll is exectued correctly 1`] = ` -start_describe_definition: describe 1 +"start_describe_definition: describe 1 add_hook: beforeAll add_test: test 1 start_describe_definition: 2nd level describe @@ -40,11 +40,11 @@ run_describe_finish: describe 1 run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`beforeEach is executed before each test in current/child describe blocks 1`] = ` -start_describe_definition: describe +"start_describe_definition: describe add_hook: beforeEach add_test: one add_test: two @@ -124,11 +124,11 @@ run_describe_finish: 2nd describe run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; exports[`multiple before each hooks in one describe are executed in the right order 1`] = ` -start_describe_definition: describe 1 +"start_describe_definition: describe 1 add_hook: beforeEach add_hook: beforeEach start_describe_definition: 2nd level describe @@ -154,5 +154,5 @@ run_describe_finish: describe 1 run_describe_finish: ROOT_DESCRIBE_BLOCK run_finish -unhandledErrors: 0 +unhandledErrors: 0" `; diff --git a/packages/jest-circus/src/__tests__/afterAll.test.ts b/packages/jest-circus/src/__tests__/afterAll.test.ts index 823991fa008b..3fdc5e9985b7 100644 --- a/packages/jest-circus/src/__tests__/afterAll.test.ts +++ b/packages/jest-circus/src/__tests__/afterAll.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {runTest} from '../__mocks__/testUtils'; test('tests are not marked done until their parent afterAll runs', () => { @@ -44,7 +43,7 @@ test('describe block cannot have hooks and no tests', () => { }) `); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); }); test('describe block _can_ have hooks if a child describe block has tests', () => { @@ -59,7 +58,7 @@ test('describe block _can_ have hooks if a child describe block has tests', () = }) }) `); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); }); test('describe block hooks must not run if describe block is skipped', () => { @@ -70,7 +69,7 @@ test('describe block hooks must not run if describe block is skipped', () => { test('my test', () => console.log('> my test')); }) `); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); }); test('child tests marked with todo should not run if describe block is skipped', () => { @@ -81,7 +80,7 @@ test('child tests marked with todo should not run if describe block is skipped', test.todo('my test'); }) `); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); }); test('child tests marked with only should not run if describe block is skipped', () => { @@ -92,5 +91,5 @@ test('child tests marked with only should not run if describe block is skipped', test.only('my test', () => console.log('> my test')); }) `); - expect(wrap(result.stdout)).toMatchSnapshot(); + expect(result.stdout).toMatchSnapshot(); }); diff --git a/packages/jest-circus/src/__tests__/baseTest.test.ts b/packages/jest-circus/src/__tests__/baseTest.test.ts index 91b3127e7d8e..429edbb39d43 100644 --- a/packages/jest-circus/src/__tests__/baseTest.test.ts +++ b/packages/jest-circus/src/__tests__/baseTest.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {runTest} from '../__mocks__/testUtils'; test('simple test', () => { @@ -18,7 +17,7 @@ test('simple test', () => { }) `); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('failures', () => { @@ -31,5 +30,5 @@ test('failures', () => { }) `); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/packages/jest-circus/src/__tests__/hooks.test.ts b/packages/jest-circus/src/__tests__/hooks.test.ts index fa807bdc9158..3d5f7f1af59e 100644 --- a/packages/jest-circus/src/__tests__/hooks.test.ts +++ b/packages/jest-circus/src/__tests__/hooks.test.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import wrap from 'jest-snapshot-serializer-raw'; import {runTest} from '../__mocks__/testUtils'; test('beforeEach is executed before each test in current/child describe blocks', () => { @@ -34,7 +33,7 @@ test('beforeEach is executed before each test in current/child describe blocks', }) `); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('multiple before each hooks in one describe are executed in the right order', () => { @@ -53,7 +52,7 @@ test('multiple before each hooks in one describe are executed in the right order }); `); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); test('beforeAll is exectued correctly', () => { @@ -70,5 +69,5 @@ test('beforeAll is exectued correctly', () => { }); `); - expect(wrap(stdout)).toMatchSnapshot(); + expect(stdout).toMatchSnapshot(); }); diff --git a/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap b/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap index 05fb989e8bc1..6eb56d528b6d 100644 --- a/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap +++ b/packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap @@ -58,7 +58,7 @@ exports[`init project using jest.config.ts ask the user whether he wants to use Array [ Object { "initial": true, - "message": "Would you like to use Jest when running \\"test\\" script in \\"package.json\\"?", + "message": "Would you like to use Jest when running "test" script in "package.json"?", "name": "scripts", "type": "confirm", }, @@ -129,7 +129,7 @@ module.exports = { // bail: 0, // The directory where Jest should store its cached dependency information - // cacheDirectory: \\"/tmp/jest\\", + // cacheDirectory: "/tmp/jest", // Automatically clear mock calls, instances and results before every test // clearMocks: false, @@ -145,18 +145,18 @@ module.exports = { // An array of regexp pattern strings used to skip coverage collection // coveragePathIgnorePatterns: [ - // \\"/node_modules/\\" + // "/node_modules/" // ], // Indicates which provider should be used to instrument code for coverage - // coverageProvider: \\"babel\\", + // coverageProvider: "babel", // A list of reporter names that Jest uses when writing coverage reports // coverageReporters: [ - // \\"json\\", - // \\"text\\", - // \\"lcov\\", - // \\"clover\\" + // "json", + // "text", + // "lcov", + // "clover" // ], // An object that configures minimum threshold enforcement for coverage results @@ -181,21 +181,21 @@ module.exports = { // globals: {}, // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: \\"50%\\", + // maxWorkers: "50%", // An array of directory names to be searched recursively up from the requiring module's location // moduleDirectories: [ - // \\"node_modules\\" + // "node_modules" // ], // An array of file extensions your modules use // moduleFileExtensions: [ - // \\"js\\", - // \\"jsx\\", - // \\"ts\\", - // \\"tsx\\", - // \\"json\\", - // \\"node\\" + // "js", + // "jsx", + // "ts", + // "tsx", + // "json", + // "node" // ], // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module @@ -208,7 +208,7 @@ module.exports = { // notify: false, // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: \\"failure-change\\", + // notifyMode: "failure-change", // A preset that is used as a base for Jest's configuration // preset: undefined, @@ -236,11 +236,11 @@ module.exports = { // A list of paths to directories that Jest should use to search for files in // roots: [ - // \\"\\" + // "" // ], // Allows you to use a custom runner instead of Jest's default test runner - // runner: \\"jest-runner\\", + // runner: "jest-runner", // The paths to modules that run some code to configure or set up the testing environment before each test // setupFiles: [], @@ -255,7 +255,7 @@ module.exports = { // snapshotSerializers: [], // The test environment that will be used for testing - // testEnvironment: \\"jest-environment-node\\", + // testEnvironment: "jest-environment-node", // Options that will be passed to the testEnvironment // testEnvironmentOptions: {}, @@ -265,13 +265,13 @@ module.exports = { // The glob patterns Jest uses to detect test files // testMatch: [ - // \\"**/__tests__/**/*.[jt]s?(x)\\", - // \\"**/?(*.)+(spec|test).[tj]s?(x)\\" + // "**/__tests__/**/*.[jt]s?(x)", + // "**/?(*.)+(spec|test).[tj]s?(x)" // ], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped // testPathIgnorePatterns: [ - // \\"/node_modules/\\" + // "/node_modules/" // ], // The regexp pattern or array of patterns that Jest uses to detect test files @@ -281,21 +281,21 @@ module.exports = { // testResultsProcessor: undefined, // This option allows use of a custom test runner - // testRunner: \\"jest-circus/runner\\", + // testRunner: "jest-circus/runner", // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href - // testURL: \\"http://localhost\\", + // testURL: "http://localhost", - // Setting this value to \\"fake\\" allows the use of fake timers for functions such as \\"setTimeout\\" - // timers: \\"real\\", + // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" + // timers: "real", // A map from regular expressions to paths to transformers // transform: undefined, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation // transformIgnorePatterns: [ - // \\"/node_modules/\\", - // \\"\\\\\\\\.pnp\\\\\\\\.[^\\\\\\\\/]+$\\" + // "/node_modules/", + // "\\\\.pnp\\\\.[^\\\\/]+$" // ], // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them @@ -315,9 +315,9 @@ module.exports = { exports[`init project with package.json and no jest config some questions answered with answer: "Yes" should create package.json with configured test command when {scripts: true} 1`] = ` "{ - \\"name\\": \\"only_package_json\\", - \\"scripts\\": { - \\"test\\": \\"jest\\" + "name": "only_package_json", + "scripts": { + "test": "jest" } } " diff --git a/packages/jest-cli/src/init/__tests__/__snapshots__/modifyPackageJson.test.ts.snap b/packages/jest-cli/src/init/__tests__/__snapshots__/modifyPackageJson.test.ts.snap index da4b30f7f0a6..64692fd5f7de 100644 --- a/packages/jest-cli/src/init/__tests__/__snapshots__/modifyPackageJson.test.ts.snap +++ b/packages/jest-cli/src/init/__tests__/__snapshots__/modifyPackageJson.test.ts.snap @@ -2,8 +2,8 @@ exports[`should add test script when there are no scripts 1`] = ` "{ - \\"scripts\\": { - \\"test\\": \\"jest\\" + "scripts": { + "test": "jest" } } " @@ -11,9 +11,9 @@ exports[`should add test script when there are no scripts 1`] = ` exports[`should add test script when there are scripts 1`] = ` "{ - \\"scripts\\": { - \\"lint\\": \\"eslint .\\", - \\"test\\": \\"jest\\" + "scripts": { + "lint": "eslint .", + "test": "jest" } } " @@ -26,8 +26,8 @@ exports[`should not add test script when { shouldModifyScripts: false } 1`] = ` exports[`should remove jest config if exists 1`] = ` "{ - \\"scripts\\": { - \\"test\\": \\"jest\\" + "scripts": { + "test": "jest" } } " diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index b6a45c61d06e..74834fb8b790 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -52,7 +52,6 @@ "@types/glob": "^7.1.1", "@types/graceful-fs": "^4.1.3", "@types/micromatch": "^4.0.1", - "jest-snapshot-serializer-raw": "^1.1.0", "semver": "^7.3.5", "strip-ansi": "^6.0.0", "ts-node": "^9.0.0", diff --git a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap index ac8587abd024..bdbe761313c2 100644 --- a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap +++ b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap @@ -3,11 +3,11 @@ exports[`Upgrade help logs a warning when \`scriptPreprocessor\` and/or \`preprocessorIgnorePatterns\` are used 1`] = ` " Deprecation Warning: - Option \\"preprocessorIgnorePatterns\\" was replaced by \\"transformIgnorePatterns\\", which support multiple preprocessors. + Option "preprocessorIgnorePatterns" was replaced by "transformIgnorePatterns", which support multiple preprocessors. Jest now treats your current configuration as: { - \\"transformIgnorePatterns\\": [\\"bar/baz\\", \\"qux/quux\\"] + "transformIgnorePatterns": ["bar/baz", "qux/quux"] } Please update your configuration. @@ -30,7 +30,7 @@ exports[`displayName generates a default color for the runner undefined 1`] = `" exports[`displayName should throw an error when displayName is is an empty object 1`] = ` "Validation Error: - Option \\"displayName\\" must be of type: + Option "displayName" must be of type: { name: string; @@ -46,7 +46,7 @@ exports[`displayName should throw an error when displayName is is an empty objec exports[`displayName should throw an error when displayName is missing color 1`] = ` "Validation Error: - Option \\"displayName\\" must be of type: + Option "displayName" must be of type: { name: string; @@ -62,7 +62,7 @@ exports[`displayName should throw an error when displayName is missing color 1`] exports[`displayName should throw an error when displayName is missing name 1`] = ` "Validation Error: - Option \\"displayName\\" must be of type: + Option "displayName" must be of type: { name: string; @@ -78,7 +78,7 @@ exports[`displayName should throw an error when displayName is missing name 1`] exports[`displayName should throw an error when displayName is using invalid values 1`] = ` "Validation Error: - Option \\"displayName\\" must be of type: + Option "displayName" must be of type: { name: string; @@ -92,46 +92,50 @@ exports[`displayName should throw an error when displayName is using invalid val `; exports[`extensionsToTreatAsEsm should enforce leading dots 1`] = ` -● Validation Error: - - Option: extensionsToTreatAsEsm: ['ts'] includes a string that does not start with a period (.). - Please change your configuration to extensionsToTreatAsEsm: ['.ts']. - - Configuration Documentation: - https://jestjs.io/docs/configuration +"Validation Error: + + Option: extensionsToTreatAsEsm: ['ts'] includes a string that does not start with a period (.). + Please change your configuration to extensionsToTreatAsEsm: ['.ts']. + + Configuration Documentation: + https://jestjs.io/docs/configuration +" `; exports[`extensionsToTreatAsEsm throws on .cjs 1`] = ` -● Validation Error: - - Option: extensionsToTreatAsEsm: ['.cjs'] includes '.cjs' which is always treated as CommonJS. - - Configuration Documentation: - https://jestjs.io/docs/configuration +"Validation Error: + + Option: extensionsToTreatAsEsm: ['.cjs'] includes '.cjs' which is always treated as CommonJS. + + Configuration Documentation: + https://jestjs.io/docs/configuration +" `; exports[`extensionsToTreatAsEsm throws on .js 1`] = ` -● Validation Error: - - Option: extensionsToTreatAsEsm: ['.js'] includes '.js' which is always inferred based on type in its nearest package.json. - - Configuration Documentation: - https://jestjs.io/docs/configuration +"Validation Error: + + Option: extensionsToTreatAsEsm: ['.js'] includes '.js' which is always inferred based on type in its nearest package.json. + + Configuration Documentation: + https://jestjs.io/docs/configuration +" `; exports[`extensionsToTreatAsEsm throws on .mjs 1`] = ` -● Validation Error: - - Option: extensionsToTreatAsEsm: ['.mjs'] includes '.mjs' which is always treated as an ECMAScript Module. - - Configuration Documentation: - https://jestjs.io/docs/configuration +"Validation Error: + + Option: extensionsToTreatAsEsm: ['.mjs'] includes '.mjs' which is always treated as an ECMAScript Module. + + Configuration Documentation: + https://jestjs.io/docs/configuration +" `; exports[`preset throws when module was found but no "jest-preset.js" or "jest-preset.json" files 1`] = ` "Validation Error: - Module exist-but-no-jest-preset should have \\"jest-preset.js\\" or \\"jest-preset.json\\" file at the root. + Module exist-but-no-jest-preset should have "jest-preset.js" or "jest-preset.json" file at the root. Configuration Documentation: https://jestjs.io/docs/configuration @@ -171,7 +175,7 @@ exports[`runner throw error when a runner is not found 1`] = ` exports[`setupTestFrameworkScriptFile logs a deprecation warning when \`setupTestFrameworkScriptFile\` is used 1`] = ` " Deprecation Warning: - Option \\"setupTestFrameworkScriptFile\\" was replaced by configuration \\"setupFilesAfterEnv\\", which supports multiple paths. + Option "setupTestFrameworkScriptFile" was replaced by configuration "setupFilesAfterEnv", which supports multiple paths. Please update your configuration. @@ -218,7 +222,7 @@ exports[`testPathPattern --testPathPattern ignores invalid regular expressions a exports[`testTimeout should throw an error if timeout is a negative number 1`] = ` "Validation Error: - Option \\"testTimeout\\" must be a natural number. + Option "testTimeout" must be a natural number. Configuration Documentation: https://jestjs.io/docs/configuration diff --git a/packages/jest-config/src/__tests__/normalize.test.ts b/packages/jest-config/src/__tests__/normalize.test.ts index b32f13298686..e570d6e66dfc 100644 --- a/packages/jest-config/src/__tests__/normalize.test.ts +++ b/packages/jest-config/src/__tests__/normalize.test.ts @@ -8,7 +8,6 @@ import {createHash} from 'crypto'; import path from 'path'; -import {wrap} from 'jest-snapshot-serializer-raw'; import semver = require('semver'); import stripAnsi from 'strip-ansi'; import type {Config} from '@jest/types'; @@ -1812,13 +1811,7 @@ describe('extensionsToTreatAsEsm', () => { }>; (): any; }) { - expect.assertions(1); - - try { - await callback(); - } catch (error: any) { - expect(wrap(stripAnsi(error.message).trim())).toMatchSnapshot(); - } + await expect(callback()).rejects.toThrowErrorMatchingSnapshot(); } it('should pass valid config through', async () => { diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 5f16a83d630f..209f1ea133c0 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -47,8 +47,7 @@ "@types/exit": "^0.1.30", "@types/graceful-fs": "^4.1.2", "@types/micromatch": "^4.0.1", - "@types/rimraf": "^3.0.0", - "jest-snapshot-serializer-raw": "^1.1.0" + "@types/rimraf": "^3.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" diff --git a/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap index 7ecbc5929cdb..b6718ce48fd7 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap @@ -44,7 +44,7 @@ Watch Usage › Press f to run only failed tests. › Press t to filter by a test name regex pattern. › Press q to quit watch mode. - › Press p to custom \\"P\\" plugin. + › Press p to custom "P" plugin. › Press Enter to trigger a test run. ", ] diff --git a/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap index a67849f20835..192bd10d4b91 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap @@ -1,83 +1,83 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Watch mode flows Pressing "P" enters pattern mode 1`] = ` - +" pattern › p [MOCK - cursorSavePosition] [MOCK - cursorTo(12, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 2`] = ` - +" pattern › p. [MOCK - cursorSavePosition] [MOCK - cursorTo(13, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 3`] = ` - +" pattern › p.* [MOCK - cursorSavePosition] [MOCK - cursorTo(14, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 4`] = ` - +" pattern › p.*1 [MOCK - cursorSavePosition] [MOCK - cursorTo(15, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 5`] = ` - +" pattern › p.*10 [MOCK - cursorSavePosition] [MOCK - cursorTo(16, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 6`] = ` - +" pattern › p.*1 [MOCK - cursorSavePosition] [MOCK - cursorTo(15, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 7`] = ` - +" pattern › p.* [MOCK - cursorSavePosition] [MOCK - cursorTo(14, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 8`] = ` - +" pattern › p.*3 [MOCK - cursorSavePosition] [MOCK - cursorTo(15, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "P" enters pattern mode 9`] = ` diff --git a/packages/jest-core/src/__tests__/__snapshots__/watchTestNamePatternMode.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/watchTestNamePatternMode.test.js.snap index d2e8394ca792..940258709a50 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/watchTestNamePatternMode.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/watchTestNamePatternMode.test.js.snap @@ -1,91 +1,91 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Watch mode flows Pressing "T" enters pattern mode 1`] = ` - +" pattern › c [MOCK - cursorSavePosition] [MOCK - cursorTo(12, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 2`] = ` - +" pattern › co [MOCK - cursorSavePosition] [MOCK - cursorTo(13, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 3`] = ` - +" pattern › con [MOCK - cursorSavePosition] [MOCK - cursorTo(14, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 4`] = ` - +" pattern › con [MOCK - cursorSavePosition] [MOCK - cursorTo(15, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 5`] = ` - +" pattern › con 1 [MOCK - cursorSavePosition] [MOCK - cursorTo(16, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 6`] = ` - +" pattern › con 12 [MOCK - cursorSavePosition] [MOCK - cursorTo(17, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 7`] = ` - +" pattern › con 1 [MOCK - cursorSavePosition] [MOCK - cursorTo(16, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 8`] = ` - +" pattern › con [MOCK - cursorSavePosition] [MOCK - cursorTo(15, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; exports[`Watch mode flows Pressing "T" enters pattern mode 9`] = ` - +" pattern › con * [MOCK - cursorSavePosition] [MOCK - cursorTo(16, 5)] -[MOCK - cursorRestorePosition] +[MOCK - cursorRestorePosition]" `; diff --git a/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js b/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js index a6ab863697dd..5322e283340a 100644 --- a/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js +++ b/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js @@ -7,7 +7,6 @@ */ import chalk from 'chalk'; -import wrap from 'jest-snapshot-serializer-raw'; // eslint-disable-next-line import/order import {KEYS} from 'jest-watcher'; @@ -116,7 +115,7 @@ describe('Watch mode flows', () => { const assertPattern = hex => { pipe.write.mockReset(); stdin.emit(hex); - expect(wrap(pipe.write.mock.calls.join('\n'))).toMatchSnapshot(); + expect(pipe.write.mock.calls.join('\n')).toMatchSnapshot(); }; // Write a pattern diff --git a/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js b/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js index 59ac0c590af6..01cb7f85a591 100644 --- a/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js +++ b/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js @@ -7,7 +7,6 @@ */ import chalk from 'chalk'; -import wrap from 'jest-snapshot-serializer-raw'; // eslint-disable-next-line import/order import {KEYS} from 'jest-watcher'; @@ -130,7 +129,7 @@ describe('Watch mode flows', () => { const assertPattern = hex => { pipe.write.mockReset(); stdin.emit(hex); - expect(wrap(pipe.write.mock.calls.join('\n'))).toMatchSnapshot(); + expect(pipe.write.mock.calls.join('\n')).toMatchSnapshot(); }; // Write a pattern 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 bf5d5881d7f1..d90a214c4873 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 @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`prints the config object 1`] = ` -{ +"{ "configs": { "automock": false, "cache": false, @@ -111,5 +111,5 @@ exports[`prints the config object 1`] = ` }, "version": 123 } - +" `; diff --git a/packages/jest-core/src/lib/__tests__/logDebugMessages.test.ts b/packages/jest-core/src/lib/__tests__/logDebugMessages.test.ts index 52915a45a1e0..cbe9afd381c5 100644 --- a/packages/jest-core/src/lib/__tests__/logDebugMessages.test.ts +++ b/packages/jest-core/src/lib/__tests__/logDebugMessages.test.ts @@ -6,7 +6,6 @@ * */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {makeGlobalConfig, makeProjectConfig} from '@jest/test-utils'; import logDebugMessages from '../logDebugMessages'; @@ -61,5 +60,5 @@ it('prints the config object', async () => { const message = await new Promise(resolve => { logDebugMessages(globalConfig, config, getOutputStream(resolve)); }); - expect(wrap(message)).toMatchSnapshot(); + expect(message).toMatchSnapshot(); }); diff --git a/packages/jest-each/src/__tests__/__snapshots__/template.test.ts.snap b/packages/jest-each/src/__tests__/__snapshots__/template.test.ts.snap index 534f55a84220..c4e912980be2 100644 --- a/packages/jest-each/src/__tests__/__snapshots__/template.test.ts.snap +++ b/packages/jest-each/src/__tests__/__snapshots__/template.test.ts.snap @@ -12,9 +12,9 @@ exports[`jest-each .describe throws error when there are additional words in fir Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .describe throws error when there are additional words in last column heading 1`] = ` @@ -24,9 +24,9 @@ exports[`jest-each .describe throws error when there are additional words in las Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .describe throws error when there are additional words in second column heading 1`] = ` @@ -36,9 +36,9 @@ exports[`jest-each .describe throws error when there are additional words in sec Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .describe throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -87,9 +87,9 @@ exports[`jest-each .describe.only throws error when there are additional words i Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .describe.only throws error when there are additional words in last column heading 1`] = ` @@ -99,9 +99,9 @@ exports[`jest-each .describe.only throws error when there are additional words i Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .describe.only throws error when there are additional words in second column heading 1`] = ` @@ -111,9 +111,9 @@ exports[`jest-each .describe.only throws error when there are additional words i Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .describe.only throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -162,9 +162,9 @@ exports[`jest-each .fdescribe throws error when there are additional words in fi Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .fdescribe throws error when there are additional words in last column heading 1`] = ` @@ -174,9 +174,9 @@ exports[`jest-each .fdescribe throws error when there are additional words in la Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .fdescribe throws error when there are additional words in second column heading 1`] = ` @@ -186,9 +186,9 @@ exports[`jest-each .fdescribe throws error when there are additional words in se Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .fdescribe throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -237,9 +237,9 @@ exports[`jest-each .fit throws error when there are additional words in first co Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .fit throws error when there are additional words in last column heading 1`] = ` @@ -249,9 +249,9 @@ exports[`jest-each .fit throws error when there are additional words in last col Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .fit throws error when there are additional words in second column heading 1`] = ` @@ -261,9 +261,9 @@ exports[`jest-each .fit throws error when there are additional words in second c Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .fit throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -312,9 +312,9 @@ exports[`jest-each .it throws error when there are additional words in first col Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .it throws error when there are additional words in last column heading 1`] = ` @@ -324,9 +324,9 @@ exports[`jest-each .it throws error when there are additional words in last colu Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .it throws error when there are additional words in second column heading 1`] = ` @@ -336,9 +336,9 @@ exports[`jest-each .it throws error when there are additional words in second co Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .it throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -387,9 +387,9 @@ exports[`jest-each .it.only throws error when there are additional words in firs Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .it.only throws error when there are additional words in last column heading 1`] = ` @@ -399,9 +399,9 @@ exports[`jest-each .it.only throws error when there are additional words in last Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .it.only throws error when there are additional words in second column heading 1`] = ` @@ -411,9 +411,9 @@ exports[`jest-each .it.only throws error when there are additional words in seco Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .it.only throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -462,9 +462,9 @@ exports[`jest-each .test throws error when there are additional words in first c Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .test throws error when there are additional words in last column heading 1`] = ` @@ -474,9 +474,9 @@ exports[`jest-each .test throws error when there are additional words in last co Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .test throws error when there are additional words in second column heading 1`] = ` @@ -486,9 +486,9 @@ exports[`jest-each .test throws error when there are additional words in second Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .test throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -537,9 +537,9 @@ exports[`jest-each .test.concurrent throws error when there are additional words Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .test.concurrent throws error when there are additional words in last column heading 1`] = ` @@ -549,9 +549,9 @@ exports[`jest-each .test.concurrent throws error when there are additional words Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .test.concurrent throws error when there are additional words in second column heading 1`] = ` @@ -561,9 +561,9 @@ exports[`jest-each .test.concurrent throws error when there are additional words Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .test.concurrent throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -612,9 +612,9 @@ exports[`jest-each .test.concurrent.only throws error when there are additional Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .test.concurrent.only throws error when there are additional words in last column heading 1`] = ` @@ -624,9 +624,9 @@ exports[`jest-each .test.concurrent.only throws error when there are additional Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .test.concurrent.only throws error when there are additional words in second column heading 1`] = ` @@ -636,9 +636,9 @@ exports[`jest-each .test.concurrent.only throws error when there are additional Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .test.concurrent.only throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -687,9 +687,9 @@ exports[`jest-each .test.concurrent.skip throws error when there are additional Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .test.concurrent.skip throws error when there are additional words in last column heading 1`] = ` @@ -699,9 +699,9 @@ exports[`jest-each .test.concurrent.skip throws error when there are additional Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .test.concurrent.skip throws error when there are additional words in second column heading 1`] = ` @@ -711,9 +711,9 @@ exports[`jest-each .test.concurrent.skip throws error when there are additional Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .test.concurrent.skip throws error when there are fewer arguments than headings over multiple rows 1`] = ` @@ -762,9 +762,9 @@ exports[`jest-each .test.only throws error when there are additional words in fi Received: -\\" +" a is the left | b | expected - \\"" + "" `; exports[`jest-each .test.only throws error when there are additional words in last column heading 1`] = ` @@ -774,9 +774,9 @@ exports[`jest-each .test.only throws error when there are additional words in la Received: -\\" +" a | b | expected value - \\"" + "" `; exports[`jest-each .test.only throws error when there are additional words in second column heading 1`] = ` @@ -786,9 +786,9 @@ exports[`jest-each .test.only throws error when there are additional words in se Received: -\\" +" a | b is the right | expected - \\"" + "" `; exports[`jest-each .test.only throws error when there are fewer arguments than headings over multiple rows 1`] = ` diff --git a/packages/jest-fake-timers/package.json b/packages/jest-fake-timers/package.json index 0bc75ed8f4b6..1783f6a70682 100644 --- a/packages/jest-fake-timers/package.json +++ b/packages/jest-fake-timers/package.json @@ -25,8 +25,7 @@ "jest-util": "^27.5.0" }, "devDependencies": { - "@types/sinonjs__fake-timers": "^6.0.1", - "jest-snapshot-serializer-raw": "^1.1.0" + "@types/sinonjs__fake-timers": "^8.1.1" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap b/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap index d1148bf32e57..035160d483e5 100644 --- a/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap +++ b/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`FakeTimers runAllTimers warns when trying to advance timers while real timers are used 1`] = ` -A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`"timers": "fake"\` in the configuration file. This warning is likely a result of a default configuration change in Jest 15. +"A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`"timers": "fake"\` in the configuration file. This warning is likely a result of a default configuration change in Jest 15. -Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15 +Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15" `; diff --git a/packages/jest-fake-timers/src/__tests__/__snapshots__/modernFakeTimers.test.ts.snap b/packages/jest-fake-timers/src/__tests__/__snapshots__/modernFakeTimers.test.ts.snap index 39cc8dd4ad64..8b00458786e1 100644 --- a/packages/jest-fake-timers/src/__tests__/__snapshots__/modernFakeTimers.test.ts.snap +++ b/packages/jest-fake-timers/src/__tests__/__snapshots__/modernFakeTimers.test.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`FakeTimers runAllTimers warns when trying to advance timers while real timers are used 1`] = `"A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`\\"timers\\": \\"fake\\"\` in the configuration file"`; +exports[`FakeTimers runAllTimers warns when trying to advance timers while real timers are used 1`] = `"A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`"timers": "fake"\` in the configuration file"`; diff --git a/packages/jest-fake-timers/src/__tests__/legacyFakeTimers.test.ts b/packages/jest-fake-timers/src/__tests__/legacyFakeTimers.test.ts index 8dca81492f51..e41be1303e39 100644 --- a/packages/jest-fake-timers/src/__tests__/legacyFakeTimers.test.ts +++ b/packages/jest-fake-timers/src/__tests__/legacyFakeTimers.test.ts @@ -7,7 +7,6 @@ import * as util from 'util'; import {runInNewContext} from 'vm'; -import wrap from 'jest-snapshot-serializer-raw'; import {ModuleMocker} from 'jest-mock'; import FakeTimers from '../legacyFakeTimers'; @@ -521,7 +520,7 @@ describe('FakeTimers', () => { }); timers.runAllTimers(); expect( - wrap(consoleWarn.mock.calls[0][0].split('\nStack Trace')[0]), + consoleWarn.mock.calls[0][0].split('\nStack Trace')[0], ).toMatchSnapshot(); consoleWarn.mockRestore(); }); diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index de000708af46..e426fbf3cc84 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -34,7 +34,6 @@ "@jest/test-utils": "^27.5.0", "@types/fb-watchman": "^2.0.0", "@types/micromatch": "^4.0.1", - "jest-snapshot-serializer-raw": "^1.1.0", "slash": "^3.0.0" }, "optionalDependencies": { diff --git a/packages/jest-haste-map/src/__tests__/__snapshots__/index.test.js.snap b/packages/jest-haste-map/src/__tests__/__snapshots__/index.test.js.snap index b6a65174682a..8de2cfeed977 100644 --- a/packages/jest-haste-map/src/__tests__/__snapshots__/index.test.js.snap +++ b/packages/jest-haste-map/src/__tests__/__snapshots__/index.test.js.snap @@ -1,39 +1,39 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`HasteMap file system changes processing recovery from duplicate module IDs recovers when the most recent duplicate is fixed 1`] = ` -The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or exclude files until there remains only one of these: +"The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or exclude files until there remains only one of these: * \`/project/fruits/Pear.js\` (module) * \`/project/fruits/another/Pear.js\` (module) - +" `; exports[`HasteMap file system changes processing recovery from duplicate module IDs recovers when the oldest version of the duplicates is fixed 1`] = ` -The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or exclude files until there remains only one of these: +"The name \`Pear\` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or exclude files until there remains only one of these: * \`/project/fruits/Pear.js\` (module) * \`/project/fruits/another/Pear.js\` (module) - +" `; exports[`HasteMap tries to crawl using node as a fallback 1`] = ` -jest-haste-map: Watchman crawl failed. Retrying once with node crawler. +"jest-haste-map: Watchman crawl failed. Retrying once with node crawler. Usually this happens when watchman isn't running. Create an empty \`.watchmanconfig\` file in your project's root folder or initialize a git or hg repository in your project. - Error: watchman error + Error: watchman error" `; exports[`HasteMap warns on duplicate mock files 1`] = ` -jest-haste-map: duplicate manual mock found: subdir/Blueberry +"jest-haste-map: duplicate manual mock found: subdir/Blueberry The following files share their name; please delete one of them: * /fruits1/__mocks__/subdir/Blueberry.js * /fruits2/__mocks__/subdir/Blueberry.js - +" `; exports[`HasteMap warns on duplicate module ids 1`] = ` -jest-haste-map: Haste module naming collision: Strawberry +"jest-haste-map: Haste module naming collision: Strawberry The following files share their name; please adjust your hasteImpl: * /fruits/Strawberry.js * /fruits/other/Strawberry.js - +" `; diff --git a/packages/jest-haste-map/src/__tests__/index.test.js b/packages/jest-haste-map/src/__tests__/index.test.js index 90ca7dccf774..e2d1262e559a 100644 --- a/packages/jest-haste-map/src/__tests__/index.test.js +++ b/packages/jest-haste-map/src/__tests__/index.test.js @@ -8,7 +8,6 @@ import crypto from 'crypto'; import * as path from 'path'; -import wrap from 'jest-snapshot-serializer-raw'; function mockHashContents(contents) { return crypto.createHash('sha1').update(contents).digest('hex'); @@ -746,7 +745,7 @@ describe('HasteMap', () => { }).build(); } catch { expect( - wrap(console.error.mock.calls[0][0].replace(/\\/g, '/')), + console.error.mock.calls[0][0].replace(/\\/g, '/'), ).toMatchSnapshot(); } }); @@ -762,9 +761,7 @@ describe('HasteMap', () => { // non-determinism later on. expect(data.map.get('Strawberry')[H.GENERIC_PLATFORM]).not.toBeDefined(); - expect( - wrap(console.warn.mock.calls[0][0].replace(/\\/g, '/')), - ).toMatchSnapshot(); + expect(console.warn.mock.calls[0][0].replace(/\\/g, '/')).toMatchSnapshot(); }); it('warns on duplicate module ids only once', async () => { @@ -1330,7 +1327,7 @@ describe('HasteMap', () => { }), ); - expect(wrap(console.warn.mock.calls[0][0])).toMatchSnapshot(); + expect(console.warn.mock.calls[0][0]).toMatchSnapshot(); }); it('tries to crawl using node as a fallback when promise fails once', async () => { @@ -1656,7 +1653,7 @@ describe('HasteMap', () => { H.MODULE, }), ); - expect(wrap(error.message.replace(/\\/g, '/'))).toMatchSnapshot(); + expect(error.message.replace(/\\/g, '/')).toMatchSnapshot(); } } diff --git a/packages/jest-jasmine2/src/__tests__/__snapshots__/expectationResultFactory.test.ts.snap b/packages/jest-jasmine2/src/__tests__/__snapshots__/expectationResultFactory.test.ts.snap index dd2fc2c56500..e851ee02c188 100644 --- a/packages/jest-jasmine2/src/__tests__/__snapshots__/expectationResultFactory.test.ts.snap +++ b/packages/jest-jasmine2/src/__tests__/__snapshots__/expectationResultFactory.test.ts.snap @@ -2,7 +2,7 @@ exports[`expectationResultFactory returns the result if failed (with \`error.stack\` not as a string). 1`] = ` "thrown: Object { - \\"stack\\": 42, + "stack": 42, }" `; diff --git a/packages/jest-leak-detector/src/__tests__/__snapshots__/index.test.ts.snap b/packages/jest-leak-detector/src/__tests__/__snapshots__/index.test.ts.snap index ac60d2bb2d8c..39e662322340 100644 --- a/packages/jest-leak-detector/src/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/jest-leak-detector/src/__tests__/__snapshots__/index.test.ts.snap @@ -8,7 +8,7 @@ exports[`complains if the value is a primitive 3`] = `"Primitives cannot leak me exports[`complains if the value is a primitive 4`] = `"Primitives cannot leak memory. You passed a number: <42>"`; -exports[`complains if the value is a primitive 5`] = `"Primitives cannot leak memory. You passed a string: <\\"foo\\">"`; +exports[`complains if the value is a primitive 5`] = `"Primitives cannot leak memory. You passed a string: <"foo">"`; exports[`complains if the value is a primitive 6`] = `"Primitives cannot leak memory. You passed a symbol: "`; diff --git a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap index a117e8c615fc..77d06c568353 100644 --- a/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap +++ b/packages/jest-message-util/src/__tests__/__snapshots__/messages.test.ts.snap @@ -12,7 +12,7 @@ exports[`codeframe 1`] = ` Whoops! - > 1 | throw new Error(\\"Whoops!\\"); + > 1 | throw new Error("Whoops!"); | ^ at Object. (file.js:1:7) @@ -33,7 +33,7 @@ exports[`formatStackTrace does not print codeframe when noStackTrace = true 1`] exports[`formatStackTrace prints code frame and stacktrace 1`] = ` " - > 1 | throw new Error(\\"Whoops!\\"); + > 1 | throw new Error("Whoops!"); | ^ at Object. (file.js:1:7) @@ -45,11 +45,11 @@ exports[`formatStackTrace should strip node internals 1`] = ` Expected value to be of type: - \\"number\\" + "number" Received: - \\"\\" + "" type: - \\"string\\" + "string" at Object.it (__tests__/test.js:8:14) " @@ -102,11 +102,11 @@ exports[`should not exclude vendor from stack trace 1`] = ` Expected value to be of type: - \\"number\\" + "number" Received: - \\"\\" + "" type: - \\"string\\" + "string" at Object.it (__tests__/vendor/cool_test.js:6:666) at Object.asyncFn (__tests__/vendor/sulu/node_modules/sulu-content-bundle/best_component.js:1:5) diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index c150c763a245..89da8a3fbd56 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -45,8 +45,7 @@ "@types/glob": "^7.1.1", "@types/graceful-fs": "^4.1.2", "@types/node": "^14.0.27", - "jest-environment-node": "^27.5.0", - "jest-snapshot-serializer-raw": "^1.1.0" + "jest-environment-node": "^27.5.0" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-runtime/src/__tests__/__snapshots__/runtime_wrap.js.snap b/packages/jest-runtime/src/__tests__/__snapshots__/runtime_wrap.js.snap index 31e19b94d748..5d3099f81f8a 100644 --- a/packages/jest-runtime/src/__tests__/__snapshots__/runtime_wrap.js.snap +++ b/packages/jest-runtime/src/__tests__/__snapshots__/runtime_wrap.js.snap @@ -1,11 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Runtime wrapCodeInModuleWrapper generates the correct args for the module wrapper 1`] = ` -({"Object.":function(module,exports,require,__dirname,__filename,jest){module.exports = "Hello!" -}}); +"({"Object.":function(module,exports,require,__dirname,__filename,jest){module.exports = "Hello!" +}});" `; exports[`Runtime wrapCodeInModuleWrapper injects "extra globals" 1`] = ` -({"Object.":function(module,exports,require,__dirname,__filename,jest,Math){module.exports = "Hello!" -}}); +"({"Object.":function(module,exports,require,__dirname,__filename,jest,Math){module.exports = "Hello!" +}});" `; diff --git a/packages/jest-runtime/src/__tests__/runtime_wrap.js b/packages/jest-runtime/src/__tests__/runtime_wrap.js index af60683b5f3d..f6b6eec73447 100644 --- a/packages/jest-runtime/src/__tests__/runtime_wrap.js +++ b/packages/jest-runtime/src/__tests__/runtime_wrap.js @@ -6,7 +6,6 @@ * */ -import {wrap} from 'jest-snapshot-serializer-raw'; let createRuntime; describe('Runtime', () => { @@ -19,7 +18,7 @@ describe('Runtime', () => { const runtime = await createRuntime(__filename); expect( - wrap(runtime.wrapCodeInModuleWrapper('module.exports = "Hello!"')), + runtime.wrapCodeInModuleWrapper('module.exports = "Hello!"'), ).toMatchSnapshot(); }); @@ -27,7 +26,7 @@ describe('Runtime', () => { const runtime = await createRuntime(__filename, {extraGlobals: ['Math']}); expect( - wrap(runtime.wrapCodeInModuleWrapper('module.exports = "Hello!"')), + runtime.wrapCodeInModuleWrapper('module.exports = "Hello!"'), ).toMatchSnapshot(); }); }); diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index a989b5781499..6e1fe98ff638 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -41,8 +41,7 @@ "@types/graceful-fs": "^4.1.2", "@types/micromatch": "^4.0.1", "@types/write-file-atomic": "^3.0.0", - "dedent": "^0.7.0", - "jest-snapshot-serializer-raw": "^1.1.0" + "dedent": "^0.7.0" }, "engines": { "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" diff --git a/packages/jest-transform/src/__tests__/ScriptTransformer.test.ts b/packages/jest-transform/src/__tests__/ScriptTransformer.test.ts index 90691081727c..ed2d68ab926a 100644 --- a/packages/jest-transform/src/__tests__/ScriptTransformer.test.ts +++ b/packages/jest-transform/src/__tests__/ScriptTransformer.test.ts @@ -6,7 +6,6 @@ * */ -import {wrap} from 'jest-snapshot-serializer-raw'; import {makeGlobalConfig, makeProjectConfig} from '@jest/test-utils'; import type {Config} from '@jest/types'; import type {Options, ShouldInstrumentOptions, Transformer} from '../types'; @@ -313,7 +312,7 @@ describe('ScriptTransformer', () => { getCoverageOptions({collectCoverage: true}), ); - expect(wrap(transformedBananaWithCoverage.code)).toMatchSnapshot(); + expect(transformedBananaWithCoverage.code).toMatchSnapshot(); // no-cache case expect(fs.readFileSync).toHaveBeenCalledTimes(1); @@ -332,7 +331,7 @@ describe('ScriptTransformer', () => { '/fruits/kiwi.js', getCoverageOptions({collectCoverage: true}), ); - expect(wrap(transformedKiwiWithCoverage.code)).toMatchSnapshot(); + expect(transformedKiwiWithCoverage.code).toMatchSnapshot(); expect(transformedBananaWithCoverage.code).not.toEqual( transformedKiwiWithCoverage.code, @@ -358,7 +357,7 @@ describe('ScriptTransformer', () => { getCoverageOptions({collectCoverage: true}), ); - expect(wrap(transformedBananaWithCoverage.code)).toMatchSnapshot(); + expect(transformedBananaWithCoverage.code).toMatchSnapshot(); // no-cache case expect(fs.readFileSync).toHaveBeenCalledTimes(1); @@ -378,7 +377,7 @@ describe('ScriptTransformer', () => { '/fruits/kiwi.js', getCoverageOptions({collectCoverage: true}), ); - expect(wrap(transformedKiwiWithCoverage.code)).toMatchSnapshot(); + expect(transformedKiwiWithCoverage.code).toMatchSnapshot(); expect(transformedBananaWithCoverage.code).not.toEqual( transformedKiwiWithCoverage.code, @@ -584,14 +583,14 @@ describe('ScriptTransformer', () => { expect(require('test_preprocessor').getCacheKey).toBeCalled(); - expect(wrap(res1.code)).toMatchSnapshot(); + expect(res1.code).toMatchSnapshot(); const res2 = scriptTransformer.transform( '/node_modules/react.js', getCoverageOptions(), ); // ignores preprocessor - expect(wrap(res2.code)).toMatchSnapshot(); + expect(res2.code).toMatchSnapshot(); }); it('in async mode, uses the supplied preprocessor', async () => { @@ -604,14 +603,14 @@ describe('ScriptTransformer', () => { expect(require('test_preprocessor').getCacheKey).toBeCalled(); - expect(wrap(res1.code)).toMatchSnapshot(); + expect(res1.code).toMatchSnapshot(); const res2 = await scriptTransformer.transformAsync( '/node_modules/react.js', getCoverageOptions(), ); // ignores preprocessor - expect(wrap(res2.code)).toMatchSnapshot(); + expect(res2.code).toMatchSnapshot(); }); it('in async mode, uses the supplied async preprocessor', async () => { @@ -627,14 +626,14 @@ describe('ScriptTransformer', () => { expect(require('test_async_preprocessor').getCacheKeyAsync).toBeCalled(); - expect(wrap(res1.code)).toMatchSnapshot(); + expect(res1.code).toMatchSnapshot(); const res2 = await scriptTransformer.transformAsync( '/node_modules/react.js', getCoverageOptions(), ); // ignores preprocessor - expect(wrap(res2.code)).toMatchSnapshot(); + expect(res2.code).toMatchSnapshot(); }); it('uses multiple preprocessors', async () => { @@ -658,15 +657,15 @@ describe('ScriptTransformer', () => { expect(require('test_preprocessor').getCacheKey).toBeCalled(); expect(require('css-preprocessor').getCacheKey).toBeCalled(); - expect(wrap(res1.code)).toMatchSnapshot(); - expect(wrap(res2.code)).toMatchSnapshot(); + expect(res1.code).toMatchSnapshot(); + expect(res2.code).toMatchSnapshot(); const res3 = scriptTransformer.transform( '/node_modules/react.js', getCoverageOptions(), ); // ignores preprocessor - expect(wrap(res3.code)).toMatchSnapshot(); + expect(res3.code).toMatchSnapshot(); }); it('uses mixture of sync/async preprocessors', async () => { @@ -690,15 +689,15 @@ describe('ScriptTransformer', () => { expect(require('test_async_preprocessor').getCacheKeyAsync).toBeCalled(); expect(require('css-preprocessor').getCacheKey).toBeCalled(); - expect(wrap(res1.code)).toMatchSnapshot(); - expect(wrap(res2.code)).toMatchSnapshot(); + expect(res1.code).toMatchSnapshot(); + expect(res2.code).toMatchSnapshot(); const res3 = await scriptTransformer.transformAsync( '/node_modules/react.js', getCoverageOptions(), ); // ignores preprocessor - expect(wrap(res3.code)).toMatchSnapshot(); + expect(res3.code).toMatchSnapshot(); }); it('writes source map if preprocessor supplies it', async () => { @@ -922,7 +921,7 @@ describe('ScriptTransformer', () => { expect(writeFileAtomic.sync).toBeCalledTimes(1); expect(console.warn).toHaveBeenCalledTimes(1); - expect(wrap(console.warn.mock.calls[0][0])).toMatchSnapshot(); + expect(console.warn.mock.calls[0][0]).toMatchSnapshot(); console.warn = warn; }); @@ -957,7 +956,7 @@ describe('ScriptTransformer', () => { expect(writeFileAtomic.sync).toBeCalledTimes(1); expect(console.warn).toHaveBeenCalledTimes(1); - expect(wrap(console.warn.mock.calls[0][0])).toMatchSnapshot(); + expect(console.warn.mock.calls[0][0]).toMatchSnapshot(); console.warn = warn; }); @@ -994,7 +993,7 @@ describe('ScriptTransformer', () => { expect(writeFileAtomic.sync).toBeCalledTimes(1); expect(console.warn).toHaveBeenCalledTimes(1); - expect(wrap(console.warn.mock.calls[0][0])).toMatchSnapshot(); + expect(console.warn.mock.calls[0][0]).toMatchSnapshot(); console.warn = warn; }); 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 b3bee10792be..eabd1aaf91d6 100644 --- a/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap +++ b/packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap @@ -2,7 +2,7 @@ exports[`ScriptTransformer (in sync mode) throws an error if \`process\` isn't defined 1`] = ` "● Invalid synchronous transformer module: - \\"skipped-required-props-preprocessor-only-async\\" specified in the \\"transform\\" object of Jest configuration + "skipped-required-props-preprocessor-only-async" specified in the "transform" object of Jest configuration must export a \`process\` function. Code Transformation Documentation: https://jestjs.io/docs/code-transformation @@ -13,11 +13,11 @@ exports[`ScriptTransformer in async mode, passes expected transform options to g [MockFunction] { "calls": Array [ Array [ - "module.exports = \\"banana\\";", + "module.exports = "banana";", "/fruits/banana.js", Object { "cacheFS": Map { - "/fruits/banana.js" => "module.exports = \\"banana\\";", + "/fruits/banana.js" => "module.exports = "banana";", }, "collectCoverage": true, "collectCoverageFrom": Array [], @@ -73,14 +73,14 @@ exports[`ScriptTransformer in async mode, passes expected transform options to g "testMatch": Array [], "testPathIgnorePatterns": Array [], "testRegex": Array [ - "\\\\.test\\\\.js$", + "\\.test\\.js$", ], "testRunner": "jest-circus/runner", "testURL": "http://localhost", "timers": "real", "transform": Array [ Array [ - "\\\\.js$", + "\\.js$", "test_preprocessor", Object { "configKey": "configValue", @@ -93,7 +93,7 @@ exports[`ScriptTransformer in async mode, passes expected transform options to g "unmockedModulePathPatterns": undefined, "watchPathIgnorePatterns": Array [], }, - "configString": "{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{\\"configKey\\":\\"configValue\\"}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -116,40 +116,40 @@ exports[`ScriptTransformer in async mode, passes expected transform options to g `; exports[`ScriptTransformer in async mode, uses the supplied async preprocessor 1`] = ` -const TRANSFORMED = { +"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,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_async_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', -}; +};" `; -exports[`ScriptTransformer in async mode, uses the supplied async preprocessor 2`] = `module.exports = "react";`; +exports[`ScriptTransformer in async mode, uses the supplied async preprocessor 2`] = `"module.exports = "react";"`; exports[`ScriptTransformer in async mode, uses the supplied preprocessor 1`] = ` -const TRANSFORMED = { +"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,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', -}; +};" `; -exports[`ScriptTransformer in async mode, uses the supplied preprocessor 2`] = `module.exports = "react";`; +exports[`ScriptTransformer in async mode, uses the supplied preprocessor 2`] = `"module.exports = "react";"`; exports[`ScriptTransformer in async mode, warns of unparseable inlined source maps from the preprocessor 1`] = ` -● Invalid source map: - The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid. - Proceeding without source mapping for that file. +"● Invalid source map: + The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid. + Proceeding without source mapping for that file." `; exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] = ` [MockFunction] { "calls": Array [ Array [ - "module.exports = \\"banana\\";", + "module.exports = "banana";", "/fruits/banana.js", Object { "cacheFS": Map { - "/fruits/banana.js" => "module.exports = \\"banana\\";", + "/fruits/banana.js" => "module.exports = "banana";", }, "collectCoverage": true, "collectCoverageFrom": Array [], @@ -205,14 +205,14 @@ exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] "testMatch": Array [], "testPathIgnorePatterns": Array [], "testRegex": Array [ - "\\\\.test\\\\.js$", + "\\.test\\.js$", ], "testRunner": "jest-circus/runner", "testURL": "http://localhost", "timers": "real", "transform": Array [ Array [ - "\\\\.js$", + "\\.js$", "test_preprocessor", Object { "configKey": "configValue", @@ -225,7 +225,7 @@ exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] "unmockedModulePathPatterns": undefined, "watchPathIgnorePatterns": Array [], }, - "configString": "{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{\\"configKey\\":\\"configValue\\"}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -251,11 +251,11 @@ exports[`ScriptTransformer passes expected transform options to getCacheKeyAsync [MockFunction] { "calls": Array [ Array [ - "module.exports = \\"banana\\";", + "module.exports = "banana";", "/fruits/banana.js", Object { "cacheFS": Map { - "/fruits/banana.js" => "module.exports = \\"banana\\";", + "/fruits/banana.js" => "module.exports = "banana";", }, "collectCoverage": true, "collectCoverageFrom": Array [], @@ -311,14 +311,14 @@ exports[`ScriptTransformer passes expected transform options to getCacheKeyAsync "testMatch": Array [], "testPathIgnorePatterns": Array [], "testRegex": Array [ - "\\\\.test\\\\.js$", + "\\.test\\.js$", ], "testRunner": "jest-circus/runner", "testURL": "http://localhost", "timers": "real", "transform": Array [ Array [ - "\\\\.js$", + "\\.js$", "test_async_preprocessor", Object { "configKey": "configValue", @@ -331,7 +331,7 @@ exports[`ScriptTransformer passes expected transform options to getCacheKeyAsync "unmockedModulePathPatterns": undefined, "watchPathIgnorePatterns": Array [], }, - "configString": "{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{\\"configKey\\":\\"configValue\\"}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}", + "configString": "{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_async_preprocessor",{"configKey":"configValue"}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}", "coverageProvider": "babel", "instrument": true, "supportsDynamicImport": false, @@ -355,7 +355,7 @@ exports[`ScriptTransformer passes expected transform options to getCacheKeyAsync exports[`ScriptTransformer throws an error if createTransformer returns object without \`process\` method 1`] = ` "● Invalid transformer module: - \\"skipped-required-create-transformer-props-preprocessor\\" specified in the \\"transform\\" object of Jest configuration + "skipped-required-create-transformer-props-preprocessor" specified in the "transform" object of Jest configuration must export a \`process\` or \`processAsync\` or \`createTransformer\` function. Code Transformation Documentation: https://jestjs.io/docs/code-transformation @@ -364,7 +364,7 @@ exports[`ScriptTransformer throws an error if createTransformer returns object w exports[`ScriptTransformer throws an error if neither \`process\` nor \`processAsync\` is defined 1`] = ` "● Invalid transformer module: - \\"skipped-required-props-preprocessor\\" specified in the \\"transform\\" object of Jest configuration + "skipped-required-props-preprocessor" specified in the "transform" object of Jest configuration must export a \`process\` or \`processAsync\` or \`createTransformer\` function. Code Transformation Documentation: https://jestjs.io/docs/code-transformation @@ -372,7 +372,7 @@ exports[`ScriptTransformer throws an error if neither \`process\` nor \`processA `; exports[`ScriptTransformer transforms a file async properly 1`] = ` -/* istanbul ignore next */ +"/* istanbul ignore next */ function cov_25u22311x4() { var path = "/fruits/banana.js"; var hash = "3f8e915bed83285455a8a16aa04dc0cf5242d755"; @@ -422,11 +422,11 @@ function cov_25u22311x4() { cov_25u22311x4(); cov_25u22311x4().s[0]++; module.exports = "banana"; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhbmFuYS5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7OztBQWZaQSxNQUFNLENBQUNDLE9BQVAsR0FBaUIsUUFBakIiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiYmFuYW5hXCI7Il19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhbmFuYS5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7OztBQWZaQSxNQUFNLENBQUNDLE9BQVAsR0FBaUIsUUFBakIiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiYmFuYW5hXCI7Il19" `; exports[`ScriptTransformer transforms a file async properly 2`] = ` -/* istanbul ignore next */ +"/* istanbul ignore next */ function cov_23yvu8etmu() { var path = "/fruits/kiwi.js"; var hash = "8b5afd38d79008f13ebc229b89ef82b12ee9447a"; @@ -520,11 +520,11 @@ module.exports = () => { cov_23yvu8etmu().s[1]++; return "kiwi"; }; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImtpd2kuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7Ozs7QUFmWkEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFNLENBQTdCIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoKSA9PiBcImtpd2lcIjsiXX0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImtpd2kuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7Ozs7QUFmWkEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFNLENBQTdCIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoKSA9PiBcImtpd2lcIjsiXX0=" `; exports[`ScriptTransformer transforms a file properly 1`] = ` -/* istanbul ignore next */ +"/* istanbul ignore next */ function cov_25u22311x4() { var path = "/fruits/banana.js"; var hash = "3f8e915bed83285455a8a16aa04dc0cf5242d755"; @@ -574,11 +574,11 @@ function cov_25u22311x4() { cov_25u22311x4(); cov_25u22311x4().s[0]++; module.exports = "banana"; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhbmFuYS5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7OztBQWZaQSxNQUFNLENBQUNDLE9BQVAsR0FBaUIsUUFBakIiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiYmFuYW5hXCI7Il19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJhbmFuYS5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7OztBQWZaQSxNQUFNLENBQUNDLE9BQVAsR0FBaUIsUUFBakIiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiYmFuYW5hXCI7Il19" `; exports[`ScriptTransformer transforms a file properly 2`] = ` -/* istanbul ignore next */ +"/* istanbul ignore next */ function cov_23yvu8etmu() { var path = "/fruits/kiwi.js"; var hash = "8b5afd38d79008f13ebc229b89ef82b12ee9447a"; @@ -672,61 +672,61 @@ module.exports = () => { cov_23yvu8etmu().s[1]++; return "kiwi"; }; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImtpd2kuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7Ozs7QUFmWkEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFNLENBQTdCIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoKSA9PiBcImtpd2lcIjsiXX0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImtpd2kuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFlWTs7Ozs7Ozs7Ozs7QUFmWkEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCLE1BQU07QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFNLENBQTdCIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAoKSA9PiBcImtpd2lcIjsiXX0=" `; exports[`ScriptTransformer uses mixture of sync/async preprocessors 1`] = ` -const TRANSFORMED = { +"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,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_async_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_async_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', -}; +};" `; exports[`ScriptTransformer uses mixture of sync/async preprocessors 2`] = ` -module.exports = { +"module.exports = { filename: /styles/App.css, rawFirstLine: root {, -}; +};" `; -exports[`ScriptTransformer uses mixture of sync/async preprocessors 3`] = `module.exports = "react";`; +exports[`ScriptTransformer uses mixture of sync/async preprocessors 3`] = `"module.exports = "react";"`; exports[`ScriptTransformer uses multiple preprocessors 1`] = ` -const TRANSFORMED = { +"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,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_preprocessor",{}],["\\\\.css$","css-preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}],[\\"\\\\\\\\.css$\\",\\"css-preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', -}; +};" `; exports[`ScriptTransformer uses multiple preprocessors 2`] = ` -module.exports = { +"module.exports = { filename: /styles/App.css, rawFirstLine: root {, -}; +};" `; -exports[`ScriptTransformer uses multiple preprocessors 3`] = `module.exports = "react";`; +exports[`ScriptTransformer uses multiple preprocessors 3`] = `"module.exports = "react";"`; exports[`ScriptTransformer uses the supplied preprocessor 1`] = ` -const TRANSFORMED = { +"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,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extensionsToTreatAsEsm":[],"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"injectGlobals":true,"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"slowTestThreshold":5,"snapshotFormat":{},"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-circus/runner","testURL":"http://localhost","timers":"real","transform":[["\\\\.js$","test_preprocessor",{}]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]},"configString":"{\\"automock\\":false,\\"cache\\":true,\\"cacheDirectory\\":\\"/cache/\\",\\"clearMocks\\":false,\\"coveragePathIgnorePatterns\\":[],\\"cwd\\":\\"/test_root_dir/\\",\\"detectLeaks\\":false,\\"detectOpenHandles\\":false,\\"errorOnDeprecated\\":false,\\"extensionsToTreatAsEsm\\":[],\\"extraGlobals\\":[],\\"forceCoverageMatch\\":[],\\"globals\\":{},\\"haste\\":{},\\"injectGlobals\\":true,\\"moduleDirectories\\":[],\\"moduleFileExtensions\\":[\\"js\\"],\\"moduleLoader\\":\\"/test_module_loader_path\\",\\"moduleNameMapper\\":[],\\"modulePathIgnorePatterns\\":[],\\"modulePaths\\":[],\\"name\\":\\"test\\",\\"prettierPath\\":\\"prettier\\",\\"resetMocks\\":false,\\"resetModules\\":false,\\"restoreMocks\\":false,\\"rootDir\\":\\"/\\",\\"roots\\":[],\\"runner\\":\\"jest-runner\\",\\"setupFiles\\":[],\\"setupFilesAfterEnv\\":[],\\"skipFilter\\":false,\\"skipNodeResolution\\":false,\\"slowTestThreshold\\":5,\\"snapshotFormat\\":{},\\"snapshotSerializers\\":[],\\"testEnvironment\\":\\"node\\",\\"testEnvironmentOptions\\":{},\\"testLocationInResults\\":false,\\"testMatch\\":[],\\"testPathIgnorePatterns\\":[],\\"testRegex\\":[\\"\\\\\\\\.test\\\\\\\\.js$\\"],\\"testRunner\\":\\"jest-circus/runner\\",\\"testURL\\":\\"http://localhost\\",\\"timers\\":\\"real\\",\\"transform\\":[[\\"\\\\\\\\.js$\\",\\"test_preprocessor\\",{}]],\\"transformIgnorePatterns\\":[\\"/node_modules/\\"],\\"watchPathIgnorePatterns\\":[]}","transformerConfig":{}}', -}; +};" `; -exports[`ScriptTransformer uses the supplied preprocessor 2`] = `module.exports = "react";`; +exports[`ScriptTransformer uses the supplied preprocessor 2`] = `"module.exports = "react";"`; exports[`ScriptTransformer warns of unparseable inlined source maps from the async preprocessor 1`] = ` -● Invalid source map: - The source map for "/fruits/banana.js" returned by "async-preprocessor-with-sourcemaps" is invalid. - Proceeding without source mapping for that file. +"● Invalid source map: + The source map for "/fruits/banana.js" returned by "async-preprocessor-with-sourcemaps" is invalid. + Proceeding without source mapping for that file." `; exports[`ScriptTransformer warns of unparseable inlined source maps from the preprocessor 1`] = ` -● Invalid source map: - The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid. - Proceeding without source mapping for that file. +"● Invalid source map: + The source map for "/fruits/banana.js" returned by "preprocessor-with-sourcemaps" is invalid. + Proceeding without source mapping for that file." `; diff --git a/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap b/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap index c7b918a31bca..d2c63f0366e0 100644 --- a/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap +++ b/packages/jest-validate/src/__tests__/__snapshots__/validate.test.ts.snap @@ -3,26 +3,26 @@ exports[`Repeated types within multiple valid examples are coalesced in error report 1`] = ` " Validation Error: - Option \\"foo\\" must be of type: + Option "foo" must be of type: string or number but instead received: boolean Example: { - \\"foo\\": \\"foo\\" + "foo": "foo" } or { - \\"foo\\": \\"bar\\" + "foo": "bar" } or { - \\"foo\\": 2 + "foo": 2 } " `; @@ -34,7 +34,7 @@ exports[`displays warning for deprecated config options 1`] = ` Jest now treats your current configuration as: { - \\"transform\\": {\\".*\\": \\"test\\"} + "transform": {".*": "test"} } Please update your configuration. @@ -44,7 +44,7 @@ exports[`displays warning for deprecated config options 1`] = ` exports[`displays warning for unknown config options 1`] = ` " Validation Warning: - Unknown option \\"unkwon\\" with value {} was found. Did you mean \\"unknown\\"? + Unknown option "unkwon" with value {} was found. Did you mean "unknown"? This is probably a typing mistake. Fixing it will remove this message. " `; @@ -52,18 +52,18 @@ exports[`displays warning for unknown config options 1`] = ` exports[`pretty prints valid config for Array 1`] = ` " Validation Error: - Option \\"coverageReporters\\" must be of type: + Option "coverageReporters" must be of type: array but instead received: object Example: { - \\"coverageReporters\\": [ - \\"json\\", - \\"text\\", - \\"lcov\\", - \\"clover\\" + "coverageReporters": [ + "json", + "text", + "lcov", + "clover" ] } " @@ -72,14 +72,14 @@ exports[`pretty prints valid config for Array 1`] = ` exports[`pretty prints valid config for Boolean 1`] = ` " Validation Error: - Option \\"automock\\" must be of type: + Option "automock" must be of type: boolean but instead received: array Example: { - \\"automock\\": false + "automock": false } " `; @@ -87,14 +87,14 @@ exports[`pretty prints valid config for Boolean 1`] = ` exports[`pretty prints valid config for Function 1`] = ` " Validation Error: - Option \\"fn\\" must be of type: + Option "fn" must be of type: function but instead received: string Example: { - \\"fn\\": (_config, _option, _deprecatedOptions) => true + "fn": (_config, _option, _deprecatedOptions) => true } " `; @@ -102,14 +102,14 @@ exports[`pretty prints valid config for Function 1`] = ` exports[`pretty prints valid config for Object 1`] = ` " Validation Error: - Option \\"haste\\" must be of type: + Option "haste" must be of type: object but instead received: number Example: { - \\"haste\\": {} + "haste": {} } " `; @@ -117,14 +117,14 @@ exports[`pretty prints valid config for Object 1`] = ` exports[`pretty prints valid config for String 1`] = ` " Validation Error: - Option \\"preset\\" must be of type: + Option "preset" must be of type: string but instead received: number Example: { - \\"preset\\": \\"react-native\\" + "preset": "react-native" } " `; @@ -132,21 +132,21 @@ exports[`pretty prints valid config for String 1`] = ` exports[`reports errors nicely when failing with multiple valid options 1`] = ` " Validation Error: - Option \\"foo\\" must be of type: + Option "foo" must be of type: string or array but instead received: number Example: { - \\"foo\\": \\"text\\" + "foo": "text" } or { - \\"foo\\": [ - \\"text\\" + "foo": [ + "text" ] } " @@ -159,7 +159,7 @@ exports[`works with custom deprecations 1`] = ` Jest now treats your current configuration as: { - \\"transform\\": {\\".*\\": \\"test\\"} + "transform": {".*": "test"} } Please update your configuration. @@ -170,14 +170,14 @@ exports[`works with custom deprecations 1`] = ` exports[`works with custom errors 1`] = ` "My Custom Error: - Option \\"test\\" must be of type: + Option "test" must be of type: array but instead received: string Example: { - \\"test\\": [ + "test": [ 1, 2 ] @@ -189,7 +189,7 @@ exports[`works with custom errors 1`] = ` exports[`works with custom warnings 1`] = ` "My Custom Warning: - Unknown option \\"unknown\\" with value \\"string\\" was found. + Unknown option "unknown" with value "string" was found. This is probably a typing mistake. Fixing it will remove this message. My custom comment" diff --git a/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap b/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap index 6d63acb8b39d..361977dc71d3 100644 --- a/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap +++ b/packages/jest-validate/src/__tests__/__snapshots__/validateCLIOptions.test.js.snap @@ -3,7 +3,7 @@ exports[`does not show suggestion when unrecognized cli param length <= 1 1`] = ` " Unrecognized CLI Parameter: - Unrecognized option \\"l\\". + Unrecognized option "l". CLI Options Documentation: https://jestjs.io/docs/cli @@ -14,7 +14,7 @@ exports[`fails for multiple unknown options 1`] = ` " Unrecognized CLI Parameters: Following options were not recognized: - [\\"jest\\", \\"test\\"] + ["jest", "test"] CLI Options Documentation: https://jestjs.io/docs/cli @@ -24,7 +24,7 @@ exports[`fails for multiple unknown options 1`] = ` exports[`fails for unknown option 1`] = ` " Unrecognized CLI Parameter: - Unrecognized option \\"unknown\\". + Unrecognized option "unknown". CLI Options Documentation: https://jestjs.io/docs/cli @@ -34,7 +34,7 @@ exports[`fails for unknown option 1`] = ` exports[`shows suggestion when unrecognized cli param length > 1 1`] = ` " Unrecognized CLI Parameter: - Unrecognized option \\"hell\\". Did you mean \\"help\\"? + Unrecognized option "hell". Did you mean "help"? CLI Options Documentation: https://jestjs.io/docs/cli diff --git a/packages/pretty-format/src/__tests__/__snapshots__/react.test.tsx.snap b/packages/pretty-format/src/__tests__/__snapshots__/react.test.tsx.snap index f79589e66984..c1175a270604 100644 --- a/packages/pretty-format/src/__tests__/__snapshots__/react.test.tsx.snap +++ b/packages/pretty-format/src/__tests__/__snapshots__/react.test.tsx.snap @@ -15,7 +15,7 @@ exports[`ReactElement plugin highlights syntax 1`] = ` exports[`ReactElement plugin highlights syntax with color from theme option 1`] = ` " - style=\\"color:red\\" + style="color:red" > Hello, Mouse! " @@ -36,7 +36,7 @@ exports[`ReactTestComponent plugin highlights syntax 1`] = ` exports[`ReactTestComponent plugin highlights syntax with color from theme option 1`] = ` " - style=\\"color:red\\" + style="color:red" > Hello, Mouse! " diff --git a/yarn.lock b/yarn.lock index 27f2a29121fc..e8944170baca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2515,7 +2515,6 @@ __metadata: jest-runner: ^27.5.0 jest-runtime: ^27.5.0 jest-snapshot: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 jest-validate: ^27.5.0 jest-watcher: ^27.5.0 @@ -2559,10 +2558,9 @@ __metadata: "@jest/types": ^27.5.0 "@sinonjs/fake-timers": ^8.0.1 "@types/node": "*" - "@types/sinonjs__fake-timers": ^6.0.1 + "@types/sinonjs__fake-timers": ^8.1.1 jest-message-util: ^27.5.0 jest-mock: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 languageName: unknown linkType: soft @@ -2637,7 +2635,6 @@ __metadata: jest-runner-tsd: ^2.0.0 jest-silent-reporter: ^0.5.0 jest-snapshot: "workspace:*" - jest-snapshot-serializer-raw: ^1.1.0 jest-watch-typeahead: ^0.6.0 jquery: ^3.2.1 lerna: ^4.0.0 @@ -2783,7 +2780,6 @@ __metadata: graceful-fs: ^4.2.9 jest-haste-map: ^27.5.0 jest-regex-util: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 micromatch: ^4.0.4 pirates: ^4.0.4 @@ -5102,10 +5098,10 @@ __metadata: languageName: node linkType: hard -"@types/sinonjs__fake-timers@npm:^6.0.1": - version: 6.0.4 - resolution: "@types/sinonjs__fake-timers@npm:6.0.4" - checksum: d2f3d2b6461794e20ec6c2ae4d68b63603ab55f2f55c4920299d3c1c2c2d366b50a54d9f91de07f069a9f7b7e86a953e3f26aedf03637a99e23aa405b9844149 +"@types/sinonjs__fake-timers@npm:^8.1.1": + version: 8.1.1 + resolution: "@types/sinonjs__fake-timers@npm:8.1.1" + checksum: 78a47b7e7911d9ffe71cd08db37553e1a7897d691dfc2863d505b6671241d25349c704b4d96f5e36e8f8fe7399a170719b33c93c7d9093c56eeae7ce88668393 languageName: node linkType: hard @@ -12558,7 +12554,6 @@ __metadata: jest-message-util: ^27.5.0 jest-runtime: ^27.5.0 jest-snapshot: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 pretty-format: ^27.5.0 slash: ^3.0.0 @@ -12621,7 +12616,6 @@ __metadata: jest-regex-util: ^27.5.0 jest-resolve: ^27.5.0 jest-runner: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 jest-validate: ^27.5.0 micromatch: ^4.0.4 @@ -12751,7 +12745,6 @@ __metadata: graceful-fs: ^4.2.9 jest-regex-util: ^27.5.0 jest-serializer: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 jest-worker: ^27.5.0 micromatch: ^4.0.4 @@ -13042,7 +13035,6 @@ __metadata: jest-regex-util: ^27.5.0 jest-resolve: ^27.5.0 jest-snapshot: ^27.5.0 - jest-snapshot-serializer-raw: ^1.1.0 jest-util: ^27.5.0 slash: ^3.0.0 strip-bom: ^4.0.0 @@ -13079,13 +13071,6 @@ __metadata: languageName: node linkType: hard -"jest-snapshot-serializer-raw@npm:^1.1.0": - version: 1.2.0 - resolution: "jest-snapshot-serializer-raw@npm:1.2.0" - checksum: 5474a7cb906ee07d2ea6e7bc192c550e101ae91fe197fdc5005ef77d769f96b6529cdaaae51fe1fb5461340505a7a3e7720cf9be64863791bfbe2f7c536d1eb1 - languageName: node - linkType: hard - "jest-snapshot@^27.5.0, jest-snapshot@workspace:*, jest-snapshot@workspace:packages/jest-snapshot": version: 0.0.0-use.local resolution: "jest-snapshot@workspace:packages/jest-snapshot"