From e3d5491642c336ba76bbc08708345f45ed8d13c6 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 28 Dec 2020 18:16:33 +0100 Subject: [PATCH] chore(e2e tests): right trim stdout and stderr consistently (#10982) --- e2e/Utils.ts | 29 ++-- .../asyncAndCallback.test.ts.snap | 12 +- .../__snapshots__/callDoneTwice.test.ts.snap | 10 +- .../chaiAssertionLibrary.ts.snap | 8 +- .../circusDeclarationErrors.test.ts.snap | 10 +- .../__snapshots__/console.test.ts.snap | 16 +- .../consoleAfterTeardown.test.ts.snap | 2 +- .../coverageHandlebars.test.ts.snap | 6 +- .../__snapshots__/coverageReport.test.ts.snap | 128 +++++++-------- .../coverageThreshold.test.ts.snap | 32 ++-- .../coverageWithoutTransform.test.ts.snap | 6 +- .../customInlineSnapshotMatchers.test.ts.snap | 8 +- .../customMatcherStackTrace.test.ts.snap | 6 +- .../declarationErrors.test.ts.snap | 4 +- .../__snapshots__/detectOpenHandles.ts.snap | 8 +- .../__snapshots__/domDiffing.test.ts.snap | 6 +- e2e/__tests__/__snapshots__/each.test.ts.snap | 4 +- .../emptyDescribeWithHooks.test.ts.snap | 14 +- .../environmentAfterTeardown.test.ts.snap | 2 +- .../errorOnDeprecated.test.ts.snap | 38 ++--- .../expectAsyncMatcher.test.ts.snap | 16 +- .../__snapshots__/failures.test.ts.snap | 146 +++++++++--------- .../findRelatedFiles.test.ts.snap | 20 +-- .../moduleNameMapper.test.ts.snap | 12 +- .../nestedTestDefinitions.test.ts.snap | 4 +- .../__snapshots__/processExit.test.ts.snap | 4 +- .../requireAfterTeardown.test.ts.snap | 2 +- .../resolveNoFileExtensions.test.ts.snap | 4 +- ...ckTraceSourceMapsWithCoverage.test.ts.snap | 4 +- .../__snapshots__/testTodo.test.ts.snap | 16 +- .../__snapshots__/transform.test.ts.snap | 22 +-- .../typescriptCoverage.test.ts.snap | 6 +- .../__snapshots__/v8Coverage.test.ts.snap | 14 +- .../watchModeOnlyFailed.test.ts.snap | 10 +- .../watchModePatterns.test.ts.snap | 1 - .../watchModeUpdateSnapshot.test.ts.snap | 10 +- .../__snapshots__/wrongEnv.test.ts.snap | 28 ++-- e2e/runJest.ts | 6 +- .../src/__performance_tests__/test.js | 7 +- 39 files changed, 352 insertions(+), 329 deletions(-) diff --git a/e2e/Utils.ts b/e2e/Utils.ts index e91c4df6fc0f..dd7c5c1d6a7a 100644 --- a/e2e/Utils.ts +++ b/e2e/Utils.ts @@ -169,7 +169,6 @@ export const sortLines = (output: string) => .split('\n') .sort() .map(str => str.trim()) - .filter(Boolean) .join('\n'); const DEFAULT_PACKAGE_JSON: PackageJson = { @@ -222,21 +221,20 @@ export const extractSummary = (stdout: string) => { const sortTests = (stdout: string) => stdout .split('\n') - .reduce((tests: Array>, line) => { + .reduce>>((tests, line) => { if (['RUNS', 'PASS', 'FAIL'].includes(line.slice(0, 4))) { - tests.push([line.trimRight()]); - } else if (line) { - tests[tests.length - 1].push(line.trimRight()); + tests.push([line]); + } else { + tests[tests.length - 1].push(line); } return tests; }, []) .sort(([a], [b]) => (a > b ? 1 : -1)) - .reduce( - (array, lines = []) => - lines.length > 1 ? array.concat(lines, '') : array.concat(lines), - [], + .map(strings => + strings.length > 1 ? `${strings.join('\n').trimRight()}\n` : strings[0], ) - .join('\n'); + .join('\n') + .trim(); export const extractSortedSummary = (stdout: string) => { const {rest, summary} = extractSummary(stdout); @@ -280,6 +278,17 @@ export const normalizeIcons = (str: string) => { .replace(new RegExp('\u221A', 'g'), '\u2713'); }; +export const rightTrimStdout = (str: string) => { + if (!str) { + return str; + } + + return str + .split('\n') + .map(str => str.trimRight()) + .join('\n'); +}; + // Certain environments (like CITGM and GH Actions) do not come with mercurial installed let hgIsInstalled: boolean | null = null; diff --git a/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap b/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap index 66a2dc6288c4..6660d59310cc 100644 --- a/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap +++ b/e2e/__tests__/__snapshots__/asyncAndCallback.test.ts.snap @@ -12,11 +12,11 @@ FAIL __tests__/promise-and-callback.test.js Returned value: Promise {} 8 | 'use strict'; - 9 | + 9 | > 10 | it('promise-returning test with callback', done => { | ^ 11 | done(); - 12 | + 12 | 13 | return Promise.resolve(); at Object.it (__tests__/promise-and-callback.test.js:10:1) @@ -27,12 +27,12 @@ FAIL __tests__/promise-and-callback.test.js Returned value: Promise {} 14 | }); - 15 | + 15 | > 16 | it('async test with callback', async done => { | ^ 17 | done(); 18 | }); - 19 | + 19 | at Object.it (__tests__/promise-and-callback.test.js:16:1) @@ -42,11 +42,11 @@ FAIL __tests__/promise-and-callback.test.js Returned value: "foobar" 18 | }); - 19 | + 19 | > 20 | it('test done before return value', done => { | ^ 21 | done(); - 22 | + 22 | 23 | return 'foobar'; at Object.it (__tests__/promise-and-callback.test.js:20:1) diff --git a/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap b/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap index ef03864dc154..48fc34812088 100644 --- a/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap +++ b/e2e/__tests__/__snapshots__/callDoneTwice.test.ts.snap @@ -11,7 +11,7 @@ FAIL __tests__/index.test.js > 10 | done(); | ^ 11 | }); - 12 | + 12 | 13 | it('should fail inside a promise', done => { at Object.done (__tests__/index.test.js:10:5) @@ -39,7 +39,7 @@ FAIL __tests__/index.test.js > 26 | done(); | ^ 27 | }); - 28 | + 28 | 29 | it('should fail', () => { at Object.done (__tests__/index.test.js:26:5) @@ -53,7 +53,7 @@ FAIL __tests__/index.test.js > 37 | done(); | ^ 38 | }); - 39 | + 39 | 40 | it('should fail', () => { at Object.done (__tests__/index.test.js:37:5) @@ -67,7 +67,7 @@ FAIL __tests__/index.test.js > 48 | done(); | ^ 49 | }); - 50 | + 50 | 51 | it('should fail', () => { at done (__tests__/index.test.js:48:5) @@ -82,7 +82,7 @@ FAIL __tests__/index.test.js > 59 | done(); | ^ 60 | }); - 61 | + 61 | 62 | it('should fail', () => { 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 1a5f6f2363cc..73cb49dc4ba4 100644 --- a/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap +++ b/e2e/__tests__/__snapshots__/chaiAssertionLibrary.ts.snap @@ -24,7 +24,7 @@ FAIL __tests__/chai_assertion.js > 13 | chai.expect('hello world').to.equal('hello sunshine'); | ^ 14 | }); - 15 | + 15 | 16 | it('should', () => { at Object.equal (__tests__/chai_assertion.js:13:35) @@ -51,7 +51,7 @@ FAIL __tests__/chai_assertion.js > 20 | actualString.should.equal(expectedString); | ^ 21 | }); - 22 | + 22 | 23 | it('assert', () => { at Object.equal (__tests__/chai_assertion.js:20:25) @@ -73,13 +73,13 @@ FAIL __tests__/chai_assertion.js - hello sunshine + hello world - 22 | + 22 | 23 | it('assert', () => { > 24 | chai.assert.strictEqual('hello world', 'hello sunshine'); | ^ 25 | }); 26 | }); - 27 | + 27 | at Object.strictEqual (__tests__/chai_assertion.js:24:17) `; diff --git a/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap b/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap index f58244619e04..e073a8300d49 100644 --- a/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap +++ b/e2e/__tests__/__snapshots__/circusDeclarationErrors.test.ts.snap @@ -8,7 +8,7 @@ FAIL __tests__/asyncDefinition.test.js Cannot add a test after tests have started running. Tests must be defined synchronously. - 10 | + 10 | 11 | Promise.resolve().then(() => { > 12 | test('async definition inside describe', () => {}); | ^ @@ -29,7 +29,7 @@ FAIL __tests__/asyncDefinition.test.js | ^ 14 | }); 15 | }); - 16 | + 16 | at eventHandler (../../packages/jest-circus/build/eventHandler.js:114:11) at afterAll (__tests__/asyncDefinition.test.js:13:5) @@ -38,13 +38,13 @@ FAIL __tests__/asyncDefinition.test.js Cannot add a test after tests have started running. Tests must be defined synchronously. - 16 | + 16 | 17 | Promise.resolve().then(() => { > 18 | test('async definition outside describe', () => {}); | ^ 19 | afterAll(() => {}); 20 | }); - 21 | + 21 | at eventHandler (../../packages/jest-circus/build/eventHandler.js:146:11) at test (__tests__/asyncDefinition.test.js:18:3) @@ -58,7 +58,7 @@ FAIL __tests__/asyncDefinition.test.js > 19 | afterAll(() => {}); | ^ 20 | }); - 21 | + 21 | at eventHandler (../../packages/jest-circus/build/eventHandler.js:114:11) at afterAll (__tests__/asyncDefinition.test.js:19:3) diff --git a/e2e/__tests__/__snapshots__/console.test.ts.snap b/e2e/__tests__/__snapshots__/console.test.ts.snap index d49da1630922..6144de7be25c 100644 --- a/e2e/__tests__/__snapshots__/console.test.ts.snap +++ b/e2e/__tests__/__snapshots__/console.test.ts.snap @@ -18,10 +18,10 @@ PASS __tests__/console.test.js This is a warning message. 12 | console.info('This is an info message.'); - 13 | + 13 | > 14 | console.warn('This is a warning message.'); | ^ - 15 | + 15 | 16 | console.error('This is an error message.'); 17 | }); @@ -31,11 +31,11 @@ PASS __tests__/console.test.js This is an error message. 14 | console.warn('This is a warning message.'); - 15 | + 15 | > 16 | console.error('This is an error message.'); | ^ 17 | }); - 18 | + 18 | at Object.error (__tests__/console.test.js:16:11) `; @@ -63,10 +63,10 @@ exports[`console printing with --verbose 1`] = ` This is a warning message. 12 | console.info('This is an info message.'); - 13 | + 13 | > 14 | console.warn('This is a warning message.'); | ^ - 15 | + 15 | 16 | console.error('This is an error message.'); 17 | }); @@ -76,11 +76,11 @@ exports[`console printing with --verbose 1`] = ` This is an error message. 14 | console.warn('This is a warning message.'); - 15 | + 15 | > 16 | console.error('This is an error message.'); | ^ 17 | }); - 18 | + 18 | at Object.error (__tests__/console.test.js:16:11) diff --git a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap index 7ecaecdb7868..91426354f382 100644 --- a/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/consoleAfterTeardown.test.ts.snap @@ -13,5 +13,5 @@ PASS __tests__/console.test.js | ^ 13 | }); 14 | }); - 15 | + 15 | `; diff --git a/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap b/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap index 7fe8d61b2167..0ad6d083ffb9 100644 --- a/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageHandlebars.test.ts.snap @@ -2,9 +2,9 @@ exports[`code coverage for Handlebars 1`] = ` -----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 75 | 66.67 | 66.67 | 66.67 | - greet.hbs | 75 | 66.67 | 66.67 | 66.67 | 10 +All files | 75 | 66.67 | 66.67 | 66.67 | + greet.hbs | 75 | 66.67 | 66.67 | 66.67 | 10 -----------|---------|----------|---------|---------|------------------- `; diff --git a/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap b/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap index e96a7a6783d0..5fff24158743 100644 --- a/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageReport.test.ts.snap @@ -2,41 +2,41 @@ exports[`collects coverage from duplicate files avoiding shared cache 1`] = ` ---------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - a | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | - b | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + a | 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 +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 | +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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - file.js | 100 | 100 | 100 | 100 | +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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 87.5 | 100 | 50 | 100 | - sum.js | 87.5 | 100 | 50 | 100 | +All files | 87.5 | 100 | 50 | 100 | + sum.js | 87.5 | 100 | 50 | 100 | ----------|---------|----------|---------|---------|------------------- `; @@ -44,19 +44,19 @@ 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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- -All files | 60 | 0 | 50 | 60 | - coverage-report | 47.37 | 0 | 25 | 50 | - file.js | 100 | 100 | 100 | 100 | - notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 - otherFile.js | 100 | 100 | 100 | 100 | - sum.js | 87.5 | 100 | 50 | 100 | - sumDependency.js | 0 | 0 | 0 | 0 | 8-12 - coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | - coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | +All files | 60 | 0 | 50 | 60 | + coverage-report | 47.37 | 0 | 25 | 50 | + file.js | 100 | 100 | 100 | 100 | + notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 + otherFile.js | 100 | 100 | 100 | 100 | + sum.js | 87.5 | 100 | 50 | 100 | + sumDependency.js | 0 | 0 | 0 | 0 | 8-12 + coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | + coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | -------------------------------------|---------|----------|---------|---------|------------------- `; @@ -70,19 +70,19 @@ Ran all test suites. exports[`outputs coverage report 1`] = ` -------------------------------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- -All files | 60 | 0 | 50 | 60 | - coverage-report | 47.37 | 0 | 25 | 50 | - file.js | 100 | 100 | 100 | 100 | - notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 - otherFile.js | 100 | 100 | 100 | 100 | - sum.js | 87.5 | 100 | 50 | 100 | - sumDependency.js | 0 | 0 | 0 | 0 | 8-12 - coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | - coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | +All files | 60 | 0 | 50 | 60 | + coverage-report | 47.37 | 0 | 25 | 50 | + file.js | 100 | 100 | 100 | 100 | + notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 + otherFile.js | 100 | 100 | 100 | 100 | + sum.js | 87.5 | 100 | 50 | 100 | + sumDependency.js | 0 | 0 | 0 | 0 | 8-12 + coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | + coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | -------------------------------------|---------|----------|---------|---------|------------------- `; @@ -95,37 +95,37 @@ Functions : 50% ( 3/6 ) Lines : 60% ( 12/20 ) ================================================================================ -------------------------------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- -All files | 60 | 0 | 50 | 60 | - coverage-report | 47.37 | 0 | 25 | 50 | - file.js | 100 | 100 | 100 | 100 | - notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 - otherFile.js | 100 | 100 | 100 | 100 | - sum.js | 87.5 | 100 | 50 | 100 | - sumDependency.js | 0 | 0 | 0 | 0 | 8-12 - coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | - coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | +All files | 60 | 0 | 50 | 60 | + coverage-report | 47.37 | 0 | 25 | 50 | + file.js | 100 | 100 | 100 | 100 | + notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 + otherFile.js | 100 | 100 | 100 | 100 | + sum.js | 87.5 | 100 | 50 | 100 | + sumDependency.js | 0 | 0 | 0 | 0 | 8-12 + coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | + 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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -------------------------------------|---------|----------|---------|---------|------------------- -All files | 60 | 0 | 50 | 60 | - coverage-report | 47.37 | 0 | 25 | 50 | - file.js | 100 | 100 | 100 | 100 | - notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 - otherFile.js | 100 | 100 | 100 | 100 | - sum.js | 87.5 | 100 | 50 | 100 | - sumDependency.js | 0 | 0 | 0 | 0 | 8-12 - coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | - coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | - identical.js | 100 | 100 | 100 | 100 | +All files | 60 | 0 | 50 | 60 | + coverage-report | 47.37 | 0 | 25 | 50 | + file.js | 100 | 100 | 100 | 100 | + notRequiredInTestSuite.js | 0 | 0 | 0 | 0 | 8-19 + otherFile.js | 100 | 100 | 100 | 100 | + sum.js | 87.5 | 100 | 50 | 100 | + sumDependency.js | 0 | 0 | 0 | 0 | 8-12 + coverage-report/cached-duplicates/a | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | + coverage-report/cached-duplicates/b | 100 | 100 | 100 | 100 | + identical.js | 100 | 100 | 100 | 100 | -------------------------------------|---------|----------|---------|---------|------------------- `; diff --git a/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap b/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap index 2357c88f67c0..c2c775449c6b 100644 --- a/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageThreshold.test.ts.snap @@ -17,20 +17,20 @@ 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 +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 | +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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - banana.js | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + banana.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- `; @@ -51,10 +51,10 @@ Ran all test suites. exports[`exits with 1 if coverage threshold is not met: stdout 1`] = ` ----------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------------|---------|----------|---------|---------|------------------- -All files | 50 | 100 | 0 | 50 | - not-covered.js | 50 | 100 | 0 | 50 | 2 +All files | 50 | 100 | 0 | 50 | + not-covered.js | 50 | 100 | 0 | 50 | 2 ----------------|---------|----------|---------|---------|------------------- `; @@ -75,10 +75,10 @@ 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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - banana.js | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + banana.js | 100 | 100 | 100 | 100 | -----------|---------|----------|---------|---------|------------------- `; @@ -101,9 +101,9 @@ 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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s -----------|---------|----------|---------|---------|------------------- -All files | 50 | 100 | 0 | 50 | - banana.js | 50 | 100 | 0 | 50 | 2 +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..243ea9ce9b34 100644 --- a/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageWithoutTransform.test.ts.snap @@ -2,9 +2,9 @@ exports[`produces code coverage for uncovered files without transformer 1`] = ` ---------------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ---------------------|---------|----------|---------|---------|------------------- -All files | 0 | 100 | 0 | 0 | - some-random-file.js | 0 | 100 | 0 | 0 | 8-10 +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 eebb3e9ff410..b26f7240ca99 100644 --- a/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customInlineSnapshotMatchers.test.ts.snap @@ -17,13 +17,13 @@ FAIL __tests__/asynchronous.test.js Received: "result #1" - 20 | + 20 | 21 | test('new async, inline snapshots', async () => { > 22 | await expect(async () => 'result #1').toMatchObservationInlineSnapshot(); | ^ 23 | await expect(async () => 'result #2').toMatchObservationInlineSnapshot(); 24 | }); - 25 | + 25 | at Object.toMatchObservationInlineSnapshot (__tests__/asynchronous.test.js:22:41) @@ -44,7 +44,7 @@ FAIL __tests__/asynchronous.test.js > 23 | await expect(async () => 'result #2').toMatchObservationInlineSnapshot(); | ^ 24 | }); - 25 | + 25 | 26 | test('mismatching async, inline snapshots', async () => { at Object.toMatchObservationInlineSnapshot (__tests__/asynchronous.test.js:23:41) @@ -58,7 +58,7 @@ FAIL __tests__/asynchronous.test.js Snapshot: "result #?" Received: "result #1" - 25 | + 25 | 26 | test('mismatching async, inline snapshots', async () => { > 27 | await expect(async () => 'result #1').toMatchObservationInlineSnapshot( | ^ diff --git a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap index 9baa065aa805..c863576b0658 100644 --- a/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customMatcherStackTrace.test.ts.snap @@ -8,11 +8,11 @@ FAIL __tests__/asynchronous.test.js We expect the stack trace and code fence for this matcher to be shown in the console. - 9 | + 9 | 10 | test('showing the stack trace for an async matcher', () => > 11 | expect(true).toThrowCustomAsyncMatcherError()); | ^ - 12 | + 12 | 13 | function toThrowCustomAsyncMatcherError() { 14 | const message = () => @@ -35,7 +35,7 @@ FAIL __tests__/sync.test.js > 45 | throw Error('qux'); | ^ 46 | }; - 47 | + 47 | 48 | // This expecation fails due to an error we throw (intentionally) at Error (__tests__/sync.test.js:45:13) diff --git a/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap b/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap index af2d42a56fb3..cdc94ba78406 100644 --- a/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap +++ b/e2e/__tests__/__snapshots__/declarationErrors.test.ts.snap @@ -4,7 +4,7 @@ exports[`errors if describe returns a Promise 1`] = ` Returning a Promise from "describe" is not supported. Tests must be defined synchronously. 9 | 'use strict'; - 10 | + 10 | > 11 | describe('Promise describe errors', () => { | ^ 12 | it('t', () => {}); @@ -18,7 +18,7 @@ exports[`errors if describe returns something 1`] = ` A "describe" callback must not return a value. 9 | 'use strict'; - 10 | + 10 | > 11 | describe('describe return errors', () => { | ^ 12 | it('t', () => {}); diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap index adde74db4e47..54666f5a111c 100644 --- a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap +++ b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap @@ -14,10 +14,10 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit ● GETADDRINFOREQWRAP 12 | const app = new Server(); - 13 | + 13 | > 14 | app.listen({host: 'localhost', port: 0}); | ^ - 15 | + 15 | at Object.listen (server.js:14:5) at Object.require (__tests__/outside.js:8:1) @@ -28,13 +28,13 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit ● Timeout - 7 | + 7 | 8 | test('something', () => { > 9 | setTimeout(() => {}, 30000); | ^ 10 | expect(true).toBe(true); 11 | }); - 12 | + 12 | at Object.setTimeout (__tests__/inside.js:9:3) `; diff --git a/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap b/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap index a99d8acde447..6252d8c45e52 100644 --- a/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap +++ b/e2e/__tests__/__snapshots__/domDiffing.test.ts.snap @@ -19,7 +19,7 @@ exports[`should work without error 1`] = ` > 14 | expect(div1).toBe(div2); | ^ 15 | }); - 16 | + 16 | 17 | test('compare span and div', () => { at Object.toBe (__tests__/dom.test.js:14:16) @@ -34,12 +34,12 @@ exports[`should work without error 1`] = ` - +
- 16 | + 16 | 17 | test('compare span and div', () => { > 18 | expect(document.createElement('div')).toBe(document.createElement('span')); | ^ 19 | }); - 20 | + 20 | at Object.toBe (__tests__/dom.test.js:18:41) diff --git a/e2e/__tests__/__snapshots__/each.test.ts.snap b/e2e/__tests__/__snapshots__/each.test.ts.snap index 98edb0ecb406..ba7e582f5982 100644 --- a/e2e/__tests__/__snapshots__/each.test.ts.snap +++ b/e2e/__tests__/__snapshots__/each.test.ts.snap @@ -61,7 +61,7 @@ FAIL __tests__/eachException.test.js Missing 1 argument 6 | */ - 7 | + 7 | > 8 | it.each\` | ^ 9 | left | right @@ -84,7 +84,7 @@ FAIL __tests__/eachException.test.js Missing 2 arguments 17 | ); - 18 | + 18 | > 19 | it.each\` | ^ 20 | left | right | up | down diff --git a/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap b/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap index af198cb7e29a..ad2f6318c6ed 100644 --- a/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap +++ b/e2e/__tests__/__snapshots__/emptyDescribeWithHooks.test.ts.snap @@ -20,12 +20,12 @@ Object { Invalid: beforeEach() may not be used in a describe block containing no tests. - 7 | + 7 | 8 | describe('a block', () => { > 9 | beforeEach(() => {}); | ^ 10 | }); - 11 | + 11 | 12 | describe('another block with tests', () => { at beforeEach (__tests__/hookInEmptyDescribe.test.js:9:3) @@ -47,13 +47,13 @@ Object { Invalid: beforeEach() may not be used in a describe block containing no tests. - 7 | + 7 | 8 | describe('a block', () => { > 9 | beforeEach(() => {}); | ^ 10 | describe('another block', () => {}); 11 | }); - 12 | + 12 | at beforeEach (__tests__/hookInEmptyNestedDescribe.test.js:9:3) at Object.describe (__tests__/hookInEmptyNestedDescribe.test.js:8:1)", @@ -74,7 +74,7 @@ Object { Invalid: beforeEach() may not be used in a describe block containing no tests. - 7 | + 7 | 8 | describe('a block', () => { > 9 | beforeEach(() => {}); | ^ @@ -110,7 +110,7 @@ Object { | ^ 12 | beforeAll(() => {}); 13 | }); - 14 | + 14 | at afterAll (__tests__/multipleHooksInEmptyDescribe.test.js:11:3) at Object.describe (__tests__/multipleHooksInEmptyDescribe.test.js:8:1) @@ -124,7 +124,7 @@ Object { > 12 | beforeAll(() => {}); | ^ 13 | }); - 14 | + 14 | 15 | describe('another block with tests', () => { at beforeAll (__tests__/multipleHooksInEmptyDescribe.test.js:12:3) diff --git a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap index 8364b2e50d2a..73b0b7d45db6 100644 --- a/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap @@ -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 afce7b831796..1e1b33645aee 100644 --- a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap +++ b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap @@ -8,13 +8,13 @@ FAIL __tests__/defaultTimeoutInterval.test.js Illegal usage of \`jasmine.DEFAULT_TIMEOUT_INTERVAL\`, prefer \`jest.setTimeout\`. - 8 | + 8 | 9 | test('Default Timeout Interval', () => { > 10 | jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; | ^ 11 | expect(true).toBe(true); 12 | }); - 13 | + 13 | at Object. (__tests__/defaultTimeoutInterval.test.js:10:3) `; @@ -33,7 +33,7 @@ FAIL __tests__/fail.test.js | ^ 12 | } 13 | }); - 14 | + 14 | at Object.fail (__tests__/fail.test.js:11:5) `; @@ -45,7 +45,7 @@ FAIL __tests__/jasmine.addMatchers.test.js Illegal usage of \`jasmine.addMatchers\`, prefer \`expect.extends\`. 7 | 'use strict'; - 8 | + 8 | > 9 | jasmine.addMatchers({ | ^ 10 | theSpanishInquisition: () => ({ @@ -63,12 +63,12 @@ FAIL __tests__/jasmine.any.test.js Illegal usage of \`jasmine.any\`, prefer \`expect.any\`. - 8 | + 8 | 9 | test('jasmine.any', () => { > 10 | expect({name: 'Jessie'}).toEqual({name: jasmine.any(String)}); | ^ 11 | }); - 12 | + 12 | at Object.any (__tests__/jasmine.any.test.js:10:51) `; @@ -81,12 +81,12 @@ FAIL __tests__/jasmine.anything.test.js Illegal usage of \`jasmine.anything\`, prefer \`expect.anything\`. - 8 | + 8 | 9 | test('jasmine.anything', () => { > 10 | expect({input: ['some', 'stuff']}).toEqual({input: jasmine.anything()}); | ^ 11 | }); - 12 | + 12 | at Object.anything (__tests__/jasmine.anything.test.js:10:62) `; @@ -99,12 +99,12 @@ FAIL __tests__/jasmine.arrayContaining.test.js Illegal usage of \`jasmine.arrayContaining\`, prefer \`expect.arrayContaining\`. - 8 | + 8 | 9 | test('jasmine.arrayContaining', () => { > 10 | expect(['some', 'stuff']).toEqual(jasmine.arrayContaining(['stuff'])); | ^ 11 | }); - 12 | + 12 | at Object.arrayContaining (__tests__/jasmine.arrayContaining.test.js:10:45) `; @@ -117,7 +117,7 @@ FAIL __tests__/jasmine.createSpy.test.js Illegal usage of \`jasmine.createSpy\`, prefer \`jest.fn\`. - 8 | + 8 | 9 | test('jasmine.createSpy', () => { > 10 | const mySpy = jasmine.createSpy(); | ^ @@ -142,7 +142,7 @@ FAIL __tests__/jasmine.objectContaining.test.js | ^ 12 | ); 13 | }); - 14 | + 14 | at Object.objectContaining (__tests__/jasmine.objectContaining.test.js:11:13) `; @@ -155,12 +155,12 @@ FAIL __tests__/jasmine.stringMatching.test.js Illegal usage of \`jasmine.stringMatching\`, prefer \`expect.stringMatching\`. - 8 | + 8 | 9 | test('jasmine.stringMatching', () => { > 10 | expect('Greetings Earthling!').toEqual(jasmine.stringMatching(/^Greetings/)); | ^ 11 | }); - 12 | + 12 | at Object.stringMatching (__tests__/jasmine.stringMatching.test.js:10:50) `; @@ -192,13 +192,13 @@ FAIL __tests__/spyOn.test.js Illegal usage of global \`spyOn\`, prefer \`jest.spyOn\`. - 13 | + 13 | 14 | test('spyOn', () => { > 15 | spyOn(subject, 'func').and.returnValue('bar'); | ^ 16 | expect(subject.func()).toBe('bar'); 17 | }); - 18 | + 18 | at Object.spyOn (__tests__/spyOn.test.js:15:3) `; @@ -212,12 +212,12 @@ FAIL __tests__/spyOnProperty.test.js Illegal usage of global \`spyOnProperty\`, prefer \`jest.spyOn\`. 22 | }; - 23 | + 23 | > 24 | const spy = spyOnProperty(obj, 'method', 'get'); | ^ - 25 | + 25 | 26 | obj.method(); - 27 | + 27 | at Object.spyOnProperty (__tests__/spyOnProperty.test.js:24:15) `; diff --git a/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap b/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap index 0c2dd06fe47c..27fac20aeced 100644 --- a/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap +++ b/e2e/__tests__/__snapshots__/expectAsyncMatcher.test.ts.snap @@ -16,11 +16,11 @@ FAIL __tests__/failure.test.js received.length: 1 - 11 | + 11 | 12 | it('fail with expected non promise values', () => > 13 | expect([1]).toHaveLengthAsync(Promise.resolve(2))); | ^ - 14 | + 14 | 15 | it('fail with expected non promise values and not', () => 16 | expect([1, 2]).not.toHaveLengthAsync(Promise.resolve(2))); @@ -35,11 +35,11 @@ FAIL __tests__/failure.test.js received.length: 2 - 14 | + 14 | 15 | it('fail with expected non promise values and not', () => > 16 | expect([1, 2]).not.toHaveLengthAsync(Promise.resolve(2))); | ^ - 17 | + 17 | 18 | it('fail with expected promise values', () => 19 | expect(Promise.resolve([1])).resolves.toHaveLengthAsync(Promise.resolve(2))); @@ -54,11 +54,11 @@ FAIL __tests__/failure.test.js received.length: 1 - 17 | + 17 | 18 | it('fail with expected promise values', () => > 19 | expect(Promise.resolve([1])).resolves.toHaveLengthAsync(Promise.resolve(2))); | ^ - 20 | + 20 | 21 | it('fail with expected promise values and not', () => 22 | expect(Promise.resolve([1, 2])).resolves.not.toHaveLengthAsync( @@ -73,13 +73,13 @@ FAIL __tests__/failure.test.js received.length: 2 - 20 | + 20 | 21 | it('fail with expected promise values and not', () => > 22 | expect(Promise.resolve([1, 2])).resolves.not.toHaveLengthAsync( | ^ 23 | Promise.resolve(2), 24 | )); - 25 | + 25 | 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 14f34bcfdc69..87f8497721ae 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -52,7 +52,7 @@ FAIL __tests__/assertionCount.test.js Expected two assertions to be called but received one assertion call. - 9 | + 9 | 10 | const throws = () => { > 11 | expect.assertions(2); | ^ @@ -74,7 +74,7 @@ FAIL __tests__/assertionCount.test.js | ^ 17 | expect.assertions(2); 18 | }; - 19 | + 19 | at Object.toBeTruthy (__tests__/assertionCount.test.js:16:17) @@ -84,13 +84,13 @@ FAIL __tests__/assertionCount.test.js Expected zero assertions to be called but received one assertion call. - 19 | + 19 | 20 | const noAssertions = () => { > 21 | expect.assertions(0); | ^ 22 | expect(true).toBeTruthy(); 23 | }; - 24 | + 24 | at Object.assertions (__tests__/assertionCount.test.js:21:10) @@ -100,12 +100,12 @@ FAIL __tests__/assertionCount.test.js Expected at least one assertion to be called but received none. - 24 | + 24 | 25 | const hasNoAssertions = () => { > 26 | expect.hasAssertions(); | ^ 27 | }; - 28 | + 28 | 29 | describe('.assertions()', () => { at Object.hasAssertions (__tests__/assertionCount.test.js:26:10) @@ -128,12 +128,12 @@ FAIL __tests__/duringTests.test.js thrown: Promise {} 12 | }; - 13 | + 13 | > 14 | test('Promise thrown during test', () => { | ^ 15 | throw Promise.resolve(5); 16 | }); - 17 | + 17 | at Object.test (__tests__/duringTests.test.js:14:1) @@ -142,7 +142,7 @@ FAIL __tests__/duringTests.test.js thrown: false 16 | }); - 17 | + 17 | > 18 | test('Boolean thrown during test', () => { | ^ 19 | // eslint-disable-next-line no-throw-literal @@ -156,7 +156,7 @@ FAIL __tests__/duringTests.test.js thrown: undefined 21 | }); - 22 | + 22 | > 23 | test('undefined thrown during test', () => { | ^ 24 | // eslint-disable-next-line no-throw-literal @@ -177,12 +177,12 @@ FAIL __tests__/duringTests.test.js } 26 | }); - 27 | + 27 | > 28 | test('Object thrown during test', () => { | ^ 29 | throw deepObject; 30 | }); - 31 | + 31 | at Object.test (__tests__/duringTests.test.js:28:1) @@ -193,7 +193,7 @@ FAIL __tests__/duringTests.test.js } 30 | }); - 31 | + 31 | > 32 | test('Object with stack prop thrown during test', () => { | ^ 33 | // eslint-disable-next-line no-throw-literal @@ -211,7 +211,7 @@ FAIL __tests__/duringTests.test.js > 39 | doesNotExist.alsoThisNot; | ^ 40 | }); - 41 | + 41 | 42 | test('done(Error)', done => { at Object.doesNotExist (__tests__/duringTests.test.js:39:3) @@ -220,12 +220,12 @@ FAIL __tests__/duringTests.test.js this is an error - 41 | + 41 | 42 | test('done(Error)', done => { > 43 | done(new Error('this is an error')); | ^ 44 | }); - 45 | + 45 | 46 | test('done(non-error)', done => { at Object. (__tests__/duringTests.test.js:43:8) @@ -241,12 +241,12 @@ FAIL __tests__/duringTests.test.js ], } - 45 | + 45 | 46 | test('done(non-error)', done => { > 47 | done(deepObject); | ^ 48 | }); - 49 | + 49 | 50 | test('returned promise rejection', () => Promise.reject(deepObject)); at Object.done (__tests__/duringTests.test.js:47:3) @@ -263,10 +263,10 @@ FAIL __tests__/duringTests.test.js } 48 | }); - 49 | + 49 | > 50 | test('returned promise rejection', () => Promise.reject(deepObject)); | ^ - 51 | + 51 | at Object.test (__tests__/duringTests.test.js:50:1) `; @@ -292,12 +292,12 @@ FAIL __tests__/testMacro.test.js Expected: 2 Received: 1 - 8 | + 8 | 9 | module.exports = (one: any, two: any) => { > 10 | expect(one).toEqual(two); | ^ 11 | }; - 12 | + 12 | at toEqual (macros.js:10:15) at Object.shouldEqual (__tests__/testMacro.test.js:13:3) @@ -323,11 +323,11 @@ FAIL __tests__/asyncFailures.test.js + "foo": "bar", } - 9 | + 9 | 10 | test('resolve, but fail', () => > 11 | expect(Promise.resolve({foo: 'bar'})).resolves.toEqual({baz: 'bar'})); | ^ - 12 | + 12 | 13 | test('reject, but fail', () => 14 | expect(Promise.reject({foo: 'bar'})).rejects.toEqual({baz: 'bar'})); @@ -345,11 +345,11 @@ FAIL __tests__/asyncFailures.test.js + "foo": "bar", } - 12 | + 12 | 13 | test('reject, but fail', () => > 14 | expect(Promise.reject({foo: 'bar'})).rejects.toEqual({baz: 'bar'})); | ^ - 15 | + 15 | 16 | test('expect reject', () => 17 | expect(Promise.resolve({foo: 'bar'})).rejects.toEqual({foo: 'bar'})); @@ -362,11 +362,11 @@ FAIL __tests__/asyncFailures.test.js Received promise resolved instead of rejected Resolved to value: {"foo": "bar"} - 15 | + 15 | 16 | test('expect reject', () => > 17 | expect(Promise.resolve({foo: 'bar'})).rejects.toEqual({foo: 'bar'})); | ^ - 18 | + 18 | 19 | test('expect resolve', () => 20 | expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'})); @@ -379,11 +379,11 @@ FAIL __tests__/asyncFailures.test.js Received promise rejected instead of resolved Rejected to value: {"foo": "bar"} - 18 | + 18 | 19 | test('expect resolve', () => > 20 | expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'})); | ^ - 21 | + 21 | 22 | test('timeout', done => { 23 | setTimeout(done, 50); @@ -394,12 +394,12 @@ FAIL __tests__/asyncFailures.test.js 20 | expect(Promise.reject({foo: 'bar'})).resolves.toEqual({foo: 'bar'})); - 21 | + 21 | > 22 | test('timeout', done => { | ^ 23 | setTimeout(done, 50); 24 | }, 5); - 25 | + 25 | at Object.test (__tests__/asyncFailures.test.js:22:1) `; @@ -435,12 +435,12 @@ FAIL __tests__/assertionError.test.js Received: false - 12 | + 12 | 13 | test('assert', () => { > 14 | assert(false); | ^ 15 | }); - 16 | + 16 | 17 | test('assert with a message', () => { at Object.assert (__tests__/assertionError.test.js:14:3) @@ -457,12 +457,12 @@ FAIL __tests__/assertionError.test.js Message: this is a message - 16 | + 16 | 17 | test('assert with a message', () => { > 18 | assert(false, 'this is a message'); | ^ 19 | }); - 20 | + 20 | 21 | test('assert.ok', () => { at Object.assert (__tests__/assertionError.test.js:18:3) @@ -476,12 +476,12 @@ FAIL __tests__/assertionError.test.js Received: false - 20 | + 20 | 21 | test('assert.ok', () => { > 22 | assert.ok(false); | ^ 23 | }); - 24 | + 24 | 25 | test('assert.ok with a message', () => { at Object.ok (__tests__/assertionError.test.js:22:10) @@ -498,12 +498,12 @@ FAIL __tests__/assertionError.test.js Message: this is a message - 24 | + 24 | 25 | test('assert.ok with a message', () => { > 26 | assert.ok(false, 'this is a message'); | ^ 27 | }); - 28 | + 28 | 29 | test('assert.equal', () => { at Object.ok (__tests__/assertionError.test.js:26:10) @@ -517,12 +517,12 @@ FAIL __tests__/assertionError.test.js Received: 1 - 28 | + 28 | 29 | test('assert.equal', () => { > 30 | assert.equal(1, 2); | ^ 31 | }); - 32 | + 32 | 33 | test('assert.notEqual', () => { at Object.equal (__tests__/assertionError.test.js:30:10) @@ -536,12 +536,12 @@ FAIL __tests__/assertionError.test.js Received: 1 - 32 | + 32 | 33 | test('assert.notEqual', () => { > 34 | assert.notEqual(1, 1); | ^ 35 | }); - 36 | + 36 | 37 | test('assert.deepEqual', () => { at Object.notEqual (__tests__/assertionError.test.js:34:10) @@ -569,12 +569,12 @@ FAIL __tests__/assertionError.test.js }, } - 36 | + 36 | 37 | test('assert.deepEqual', () => { > 38 | assert.deepEqual({a: {b: {c: 5}}}, {a: {b: {c: 6}}}); | ^ 39 | }); - 40 | + 40 | 41 | test('assert.deepEqual with a message', () => { at Object.deepEqual (__tests__/assertionError.test.js:38:10) @@ -605,12 +605,12 @@ FAIL __tests__/assertionError.test.js }, } - 40 | + 40 | 41 | test('assert.deepEqual with a message', () => { > 42 | assert.deepEqual({a: {b: {c: 5}}}, {a: {b: {c: 7}}}, 'this is a message'); | ^ 43 | }); - 44 | + 44 | 45 | test('assert.notDeepEqual', () => { at Object.deepEqual (__tests__/assertionError.test.js:42:10) @@ -628,12 +628,12 @@ FAIL __tests__/assertionError.test.js Compared values have no visual difference. - 44 | + 44 | 45 | test('assert.notDeepEqual', () => { > 46 | assert.notDeepEqual({a: 1}, {a: 1}); | ^ 47 | }); - 48 | + 48 | 49 | test('assert.strictEqual', () => { at Object.notDeepEqual (__tests__/assertionError.test.js:46:10) @@ -647,12 +647,12 @@ FAIL __tests__/assertionError.test.js Received: 1 - 48 | + 48 | 49 | test('assert.strictEqual', () => { > 50 | assert.strictEqual(1, NaN); | ^ 51 | }); - 52 | + 52 | 53 | test('assert.notStrictEqual', () => { at Object.strictEqual (__tests__/assertionError.test.js:50:10) @@ -669,12 +669,12 @@ FAIL __tests__/assertionError.test.js Message: My custom error message - 52 | + 52 | 53 | test('assert.notStrictEqual', () => { > 54 | assert.notStrictEqual(1, 1, 'My custom error message'); | ^ 55 | }); - 56 | + 56 | 57 | test('assert.deepStrictEqual', () => { at Object.notStrictEqual (__tests__/assertionError.test.js:54:10) @@ -698,12 +698,12 @@ FAIL __tests__/assertionError.test.js + "a": 1, } - 56 | + 56 | 57 | test('assert.deepStrictEqual', () => { > 58 | assert.deepStrictEqual({a: 1}, {a: 2}); | ^ 59 | }); - 60 | + 60 | 61 | test('assert.notDeepStrictEqual', () => { at Object.deepStrictEqual (__tests__/assertionError.test.js:58:10) @@ -721,12 +721,12 @@ FAIL __tests__/assertionError.test.js Compared values have no visual difference. - 60 | + 60 | 61 | test('assert.notDeepStrictEqual', () => { > 62 | assert.notDeepStrictEqual({a: 1}, {a: 1}); | ^ 63 | }); - 64 | + 64 | 65 | test('assert.ifError', () => { at Object.notDeepStrictEqual (__tests__/assertionError.test.js:62:10) @@ -747,12 +747,12 @@ FAIL __tests__/assertionError.test.js Comparing two different types of values. Expected null but received number. - 64 | + 64 | 65 | test('assert.ifError', () => { > 66 | assert.ifError(1); | ^ 67 | }); - 68 | + 68 | 69 | test('assert.doesNotThrow', () => { at Object.ifError (__tests__/assertionError.test.js:66:10) @@ -769,7 +769,7 @@ FAIL __tests__/assertionError.test.js Got unwanted exception. Actual message: "err!" - 68 | + 68 | 69 | test('assert.doesNotThrow', () => { > 70 | assert.doesNotThrow(() => { | ^ @@ -789,12 +789,12 @@ FAIL __tests__/assertionError.test.js Message: Missing expected exception. - 74 | + 74 | 75 | test('assert.throws', () => { > 76 | assert.throws(() => {}); | ^ 77 | }); - 78 | + 78 | 79 | test('async', async () => { at Object.throws (__tests__/assertionError.test.js:76:10) @@ -820,12 +820,12 @@ FAIL __tests__/assertionError.test.js hello + goodbye - 78 | + 78 | 79 | test('async', async () => { > 80 | assert.equal('hello\\ngoodbye', 'hello', 'hmmm'); | ^ 81 | }); - 82 | + 82 | 83 | test('assert.fail', () => { at Object.equal (__tests__/assertionError.test.js:80:10) @@ -834,12 +834,12 @@ FAIL __tests__/assertionError.test.js assert.fail(received, expected) - 82 | + 82 | 83 | test('assert.fail', () => { > 84 | assert.fail(); | ^ 85 | }); - 86 | + 86 | 87 | test('assert.fail with a message', () => { at Object.fail (__tests__/assertionError.test.js:84:10) @@ -851,12 +851,12 @@ FAIL __tests__/assertionError.test.js Message: error! - 86 | + 86 | 87 | test('assert.fail with a message', () => { > 88 | assert.fail('error!'); | ^ 89 | }); - 90 | + 90 | at Object.fail (__tests__/assertionError.test.js:88:10) `; @@ -874,12 +874,12 @@ FAIL __tests__/snapshot.test.js Snapshot: "bar" Received: "foo" - 9 | + 9 | 10 | test('failing snapshot', () => { > 11 | expect('foo').toMatchSnapshot(); | ^ 12 | }); - 13 | + 13 | at Object.toMatchSnapshot (__tests__/snapshot.test.js:11:17) @@ -900,12 +900,12 @@ FAIL __tests__/snapshotWithHint.test.js Snapshot: "bar" Received: "foo" - 9 | + 9 | 10 | test('failing snapshot with hint', () => { > 11 | expect('foo').toMatchSnapshot('descriptive hint'); | ^ 12 | }); - 13 | + 13 | at Object.toMatchSnapshot (__tests__/snapshotWithHint.test.js:11:17) diff --git a/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap b/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap index d7cf67285466..053e89fb6610 100644 --- a/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap +++ b/e2e/__tests__/__snapshots__/findRelatedFiles.test.ts.snap @@ -15,10 +15,10 @@ PASS __tests__/a.test.js exports[`--findRelatedTests flag coverage configuration is applied correctly 3`] = ` ----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - a.js | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + a.js | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|------------------- `; @@ -37,11 +37,11 @@ PASS __tests__/b.test.js exports[`--findRelatedTests flag generates coverage report for filename 3`] = ` ----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +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 | +All files | 100 | 100 | 100 | 100 | + a.js | 100 | 100 | 100 | 100 | + b.js | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|------------------- `; @@ -60,9 +60,9 @@ PASS __tests__/a.test.js exports[`--findRelatedTests flag generates coverage report for filename 6`] = ` ----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - a.js | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + a.js | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|------------------- `; diff --git a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap index 1ad7a5de2304..bde4f6ab1366 100644 --- a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap +++ b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap @@ -34,12 +34,12 @@ FAIL __tests__/index.js } 8 | 'use strict'; - 9 | + 9 | > 10 | require('./style.css'); | ^ - 11 | + 11 | 12 | module.exports = () => 'test'; - 13 | + 13 | at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:556:17) at Object.require (index.js:10:1) @@ -63,12 +63,12 @@ FAIL __tests__/index.js } 8 | 'use strict'; - 9 | + 9 | > 10 | require('./style.css'); | ^ - 11 | + 11 | 12 | module.exports = () => 'test'; - 13 | + 13 | at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:556:17) at Object.require (index.js:10:1) diff --git a/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap b/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap index daba859d0094..f1aadd887409 100644 --- a/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/nestedTestDefinitions.test.ts.snap @@ -10,7 +10,7 @@ FAIL __tests__/nestedTestWithinDescribe.js Tests cannot be nested. Test "inner test" cannot run because it is nested within "outer test". 14 | expect(getTruthy()).toBeTruthy(); - 15 | + 15 | > 16 | test('inner test', () => { | ^ 17 | expect(getTruthy()).toBeTruthy(); @@ -29,7 +29,7 @@ FAIL __tests__/nestedTestOutsideDescribe.js Tests cannot be nested. Test "inner test" cannot run because it is nested within "outer test". 13 | expect(getTruthy()).toBeTruthy(); - 14 | + 14 | > 15 | test('inner test', () => { | ^ 16 | expect(getTruthy()).toEqual('This test should not have run'); diff --git a/e2e/__tests__/__snapshots__/processExit.test.ts.snap b/e2e/__tests__/__snapshots__/processExit.test.ts.snap index b8a26db6c53b..f2551b7cbcb0 100644 --- a/e2e/__tests__/__snapshots__/processExit.test.ts.snap +++ b/e2e/__tests__/__snapshots__/processExit.test.ts.snap @@ -4,10 +4,10 @@ exports[`prints stack trace pointing to process.exit call 1`] = ` ● process.exit called with "1" 6 | */ - 7 | + 7 | > 8 | process.exit(1); | ^ - 9 | + 9 | 10 | test('something', () => { 11 | expect(true).toBe(true); diff --git a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap index 31790c844a8d..2d1c9bcc2b9e 100644 --- a/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap +++ b/e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap @@ -7,7 +7,7 @@ ReferenceError: You are trying to \`import\` a file after the Jest environment h 10 | setTimeout(() => { > 11 | const double = require('../'); | ^ - 12 | + 12 | 13 | expect(double(5)).toBe(10); 14 | }, 0); `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index bb8b88769e7c..2593356c7eae 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -32,10 +32,10 @@ FAIL __tests__/test.js See https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring 6 | */ - 7 | + 7 | > 8 | module.exports = require('./some-json-file'); | ^ - 9 | + 9 | at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:311:11) at Object.require (index.js:8:18) diff --git a/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap b/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap index ae72faca42af..851a0a6f4e95 100644 --- a/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap +++ b/e2e/__tests__/__snapshots__/stackTraceSourceMapsWithCoverage.test.ts.snap @@ -8,12 +8,12 @@ FAIL __tests__/fails.ts This did not work! - 13 | + 13 | 14 | export function error() { > 15 | throw new Error('This did not work!'); | ^ 16 | } - 17 | + 17 | at Object.error (lib.ts:15:9) at Object. (__tests__/fails.ts:10:3) diff --git a/e2e/__tests__/__snapshots__/testTodo.test.ts.snap b/e2e/__tests__/__snapshots__/testTodo.test.ts.snap index 5ae29dea7ce8..55e5653336c8 100644 --- a/e2e/__tests__/__snapshots__/testTodo.test.ts.snap +++ b/e2e/__tests__/__snapshots__/testTodo.test.ts.snap @@ -7,10 +7,10 @@ FAIL __tests__/todoNonString.test.js Todo must be called with only a description. 6 | */ - 7 | + 7 | > 8 | it.todo(() => {}); | ^ - 9 | + 9 | at Object.todo (__tests__/todoNonString.test.js:8:4) `; @@ -22,10 +22,10 @@ FAIL __tests__/todoMultipleArgs.test.js Todo must be called with only a description. 6 | */ - 7 | + 7 | > 8 | it.todo('todo later', () => {}); | ^ - 9 | + 9 | at Object.todo (__tests__/todoMultipleArgs.test.js:8:4) `; @@ -37,10 +37,10 @@ FAIL __tests__/todoNoArgs.test.js Todo must be called with only a description. 6 | */ - 7 | + 7 | > 8 | it.todo(); | ^ - 9 | + 9 | at Object.todo (__tests__/todoNoArgs.test.js:8:4) `; @@ -67,12 +67,12 @@ FAIL __tests__/statuses.test.js Expected: 101 Received: 10 - 11 | + 11 | 12 | it('fails', () => { > 13 | expect(10).toBe(101); | ^ 14 | }); - 15 | + 15 | 16 | it.skip('skips', () => { at Object.toBe (__tests__/statuses.test.js:13:14) diff --git a/e2e/__tests__/__snapshots__/transform.test.ts.snap b/e2e/__tests__/__snapshots__/transform.test.ts.snap index a68d884e885c..81c2ad0e6333 100644 --- a/e2e/__tests__/__snapshots__/transform.test.ts.snap +++ b/e2e/__tests__/__snapshots__/transform.test.ts.snap @@ -11,35 +11,35 @@ FAIL __tests__/ignoredFile.test.js exports[`babel-jest instruments only specific files and collects coverage 1`] = ` ------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- -All files | 83.33 | 100 | 50 | 80 | - covered.js | 83.33 | 100 | 50 | 80 | 13 +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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 0 | 0 | 0 | 0 | +All files | 0 | 0 | 0 | 0 | ----------|---------|----------|---------|---------|------------------- `; exports[`no babel-jest instrumentation with no babel-jest 1`] = ` ------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- -All files | 83.33 | 100 | 50 | 80 | - covered.js | 83.33 | 100 | 50 | 80 | 13 +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 +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- -All files | 83.33 | 100 | 50 | 80 | - Covered.js | 83.33 | 100 | 50 | 80 | 13 +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..c30506ff553a 100644 --- a/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap +++ b/e2e/__tests__/__snapshots__/typescriptCoverage.test.ts.snap @@ -2,9 +2,9 @@ exports[`instruments and collects coverage for typescript files 1`] = ` ------------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - covered.ts | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + covered.ts | 100 | 100 | 100 | 100 | ------------|---------|----------|---------|---------|------------------- `; diff --git a/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap b/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap index b2ec317a31d6..535e824765ac 100644 --- a/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap +++ b/e2e/__tests__/__snapshots__/v8Coverage.test.ts.snap @@ -2,10 +2,10 @@ exports[`prints coverage with empty sourcemaps 1`] = ` ----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------|---------|----------|---------|---------|------------------- -All files | 100 | 100 | 100 | 100 | - types.ts | 100 | 100 | 100 | 100 | +All files | 100 | 100 | 100 | 100 | + types.ts | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|------------------- `; @@ -16,10 +16,10 @@ exports[`prints coverage with missing sourcemaps 1`] = ` at Object.log (__tests__/Thing.test.js:10:9) ----------|---------|----------|---------|---------|------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +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 | +All files | 100 | 100 | 100 | 100 | + Thing.js | 100 | 100 | 100 | 100 | + x.css | 100 | 100 | 100 | 100 | ----------|---------|----------|---------|---------|------------------- `; diff --git a/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap b/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap index b6c02af2bf25..ee4cd32571a0 100644 --- a/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModeOnlyFailed.test.ts.snap @@ -3,11 +3,15 @@ exports[`can press "f" to run only failed tests: test results 1`] = ` FAIL __tests__/bar.spec.js ● bar 1 + expect(received).toBe(expected) // Object.is equality + Expected: "foo" Received: "bar" + > 1 | test('bar 1', () => { expect('bar').toBe('foo'); }); | ^ + at Object.toBe (__tests__/bar.spec.js:1:37) PASS __tests__/foo.spec.js @@ -16,14 +20,18 @@ PASS __tests__/foo.spec.js exports[`can press "f" to run only failed tests: test results 2`] = ` FAIL __tests__/bar.spec.js ✕ bar 1 + ● bar 1 + expect(received).toBe(expected) // Object.is equality + Expected: "foo" Received: "bar" + > 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`] = ` diff --git a/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap b/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap index f6764504118d..c21bdb00cd2d 100644 --- a/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModePatterns.test.ts.snap @@ -24,7 +24,6 @@ exports[`can press "p" to filter by file name: test results 2`] = ` PASS __tests__/bar.spec.js ✓ bar 1 ✓ bar 2 - `; exports[`can press "p" to filter by file name: test summary 1`] = ` diff --git a/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap b/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap index 2c1b7fe0d028..6120e194f5b5 100644 --- a/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap +++ b/e2e/__tests__/__snapshots__/watchModeUpdateSnapshot.test.ts.snap @@ -3,27 +3,33 @@ exports[`can press "u" to update snapshots: test results 1`] = ` FAIL __tests__/bar.spec.js ✕ bar + ● bar + expect(received).toMatchSnapshot() + Snapshot name: \`bar 1\` + Snapshot: "foo" Received: "bar" + > 1 | test('bar', () => { expect('bar').toMatchSnapshot(); }); | ^ + at Object.toMatchSnapshot (__tests__/bar.spec.js:1:35) + › 1 snapshot failed. Snapshot Summary › 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 ✓ bar + › 1 snapshot updated. Snapshot Summary › 1 snapshot updated from 1 test suite. - `; exports[`can press "u" to update snapshots: test summary 1`] = ` diff --git a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap index d551b668ba8c..46de95fd905d 100644 --- a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap +++ b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap @@ -13,13 +13,13 @@ FAIL __tests__/node.js ReferenceError: document is not defined - 14 | + 14 | 15 | test('use document', () => { > 16 | const div = document.createElement('div'); | ^ - 17 | + 17 | 18 | console.log(div); - 19 | + 19 | at Object.document (__tests__/node.js:16:15) `; @@ -37,13 +37,13 @@ FAIL __tests__/node.js ReferenceError: navigator is not defined - 30 | + 30 | 31 | test('use navigator', () => { > 32 | const userAgent = navigator.userAgent; | ^ - 33 | + 33 | 34 | console.log(userAgent); - 35 | + 35 | at Object.navigator (__tests__/node.js:32:21) `; @@ -59,11 +59,11 @@ FAIL __tests__/jsdom.js TypeError: setTimeout(...).unref is not a function - 11 | + 11 | 12 | test('use unref', () => { > 13 | setTimeout(() => {}, 0).unref(); | ^ - 14 | + 14 | 15 | expect(1).toBe(1); 16 | }); @@ -83,13 +83,13 @@ FAIL __tests__/node.js ReferenceError: window is not defined - 22 | + 22 | 23 | test('use window', () => { > 24 | const location = window.location; | ^ - 25 | + 25 | 26 | console.log(location); - 27 | + 27 | at Object.window (__tests__/node.js:24:20) `; @@ -104,12 +104,12 @@ FAIL __tests__/beforeTest.js ReferenceError: document is not defined 11 | /* eslint-env browser */ - 12 | + 12 | > 13 | const div = document.createElement('div'); | ^ - 14 | + 14 | 15 | console.log(div); - 16 | + 16 | at Object.document (__tests__/beforeTest.js:13:13) `; diff --git a/e2e/runJest.ts b/e2e/runJest.ts index 56c25746739b..0c7d371a4c53 100644 --- a/e2e/runJest.ts +++ b/e2e/runJest.ts @@ -13,7 +13,7 @@ import * as fs from 'graceful-fs'; import stripAnsi = require('strip-ansi'); import type {FormattedTestResults} from '@jest/test-result'; import type {Config} from '@jest/types'; -import {normalizeIcons} from './Utils'; +import {normalizeIcons, rightTrimStdout} from './Utils'; const JEST_PATH = path.resolve(__dirname, '../packages/jest-cli/bin/jest.js'); @@ -108,10 +108,10 @@ function normalizeStdoutAndStderr( result: RunJestResult, options: RunJestOptions, ): RunJestResult { - result.stdout = normalizeIcons(result.stdout); if (options.stripAnsi) result.stdout = stripAnsi(result.stdout); - result.stderr = normalizeIcons(result.stderr); + result.stdout = normalizeIcons(rightTrimStdout(result.stdout)); if (options.stripAnsi) result.stderr = stripAnsi(result.stderr); + result.stderr = normalizeIcons(rightTrimStdout(result.stderr)); return result; } diff --git a/packages/jest-worker/src/__performance_tests__/test.js b/packages/jest-worker/src/__performance_tests__/test.js index 10e2571426fe..87bf958b670d 100644 --- a/packages/jest-worker/src/__performance_tests__/test.js +++ b/packages/jest-worker/src/__performance_tests__/test.js @@ -16,12 +16,13 @@ const JestWorker = require('../../build').Worker; // Typical tests: node --expose-gc test.js empty 100000 // node --expose-gc test.js loadTest 10000 assert(process.argv[2], 'Pass a child method name'); -assert(process.argv[3], 'Pass the number of iteratitons'); +assert(process.argv[3], 'Pass the number of iterations'); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); const method = process.argv[2]; const calls = +process.argv[3]; const threads = 6; +const iterations = 10; function testWorkerFarm() { return new Promise(async resolve => { @@ -132,7 +133,7 @@ async function main() { const wFResults = []; const jWResults = []; - for (let i = 0; i < 10; i++) { + for (let i = 0; i < iterations; i++) { console.log('-'.repeat(75)); profile('worker farm'); @@ -161,7 +162,7 @@ async function main() { let jWGT = 0; let jWPT = 0; - for (let i = 0; i < 10; i++) { + for (let i = 0; i < iterations; i++) { wFGT += wFResults[i].globalTime; wFPT += wFResults[i].processingTime;