Skip to content

Commit

Permalink
use raw serializer for e2e output snapshots (jestjs#7651)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored and captain-yossarian committed Jul 18, 2019
1 parent 49750f8 commit a0aff2e
Show file tree
Hide file tree
Showing 160 changed files with 826 additions and 1,061 deletions.
5 changes: 4 additions & 1 deletion e2e/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ export const extractSummary = (stdout: string) => {
// remove all timestamps
.replace(/\s*\(\d*\.?\d+m?s\)$/gm, '');

return {rest, summary};
return {
rest: rest.trim(),
summary: summary.trim(),
};
};

const sortTests = (stdout: string) =>
Expand Down
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/beforeAllFiltered.js.snap
Original file line number Diff line number Diff line change
@@ -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 __tests__/beforeAllFiltered.test.js:5
console.log __tests__/beforeAllFiltered.test.js:5
beforeAll 1
console.log __tests__/beforeAllFiltered.test.js:8
Expand All @@ -15,5 +15,5 @@ exports[`Correct BeforeAll run ensures the BeforeAll of ignored suite is not run
console.log __tests__/beforeAllFiltered.test.js:14
afterAll 1
"
`;
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/beforeEachQueue.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] = `
" console.log __tests__/beforeEachQueue.test.js:5
console.log __tests__/beforeEachQueue.test.js:5
BeforeEach
console.log __tests__/beforeEachQueue.test.js:9
Expand All @@ -15,5 +15,5 @@ exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] =
console.log __tests__/beforeEachQueue.test.js:17
It Bar
"
`;
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// 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?"
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: <<REPLACED>>
Ran all test suites matching /.\\\\/foo\\\\/bar.spec.js/i."
Ran all test suites matching /.\\/foo\\/bar.spec.js/i.
`;
exports[`CLI accepts exact file names if matchers matched 3`] = `""`;
43 changes: 16 additions & 27 deletions e2e/__tests__/__snapshots__/console.test.js.snap
Original file line number Diff line number Diff line change
@@ -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 __tests__/console.test.js:10
Expand All @@ -12,21 +12,18 @@ exports[`console printing 1`] = `
This is a warning message.
console.error __tests__/console.test.js:16
This is an error message.
"
`;

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: <<REPLACED>>
Ran all test suites."
Ran all test suites.
`;
exports[`console printing with --verbose 1`] = `
" console.log __tests__/console.test.js:10
console.log __tests__/console.test.js:10
This is a log message.
console.info __tests__/console.test.js:12
Expand All @@ -37,52 +34,44 @@ exports[`console printing with --verbose 1`] = `
console.error __tests__/console.test.js:16
This is an error message.
"
`;
exports[`console printing with --verbose 2`] = `
"PASS __tests__/console.test.js
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: <<REPLACED>>
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: <<REPLACED>>"
Time: <<REPLACED>>
`;
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
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: <<REPLACED>>
Ran all test suites."
Ran all test suites.
`;
Original file line number Diff line number Diff line change
@@ -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?"
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: <<REPLACED>>
Ran all test suites."
Ran all test suites.
`;
exports[`prints console.logs when run with forceExit 3`] = `
" console.log __tests__/a-banana.js:2
console.log __tests__/a-banana.js:2
Hey
"
`;
41 changes: 20 additions & 21 deletions e2e/__tests__/__snapshots__/coverageReport.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
// 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 | |
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 |
--------------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
otherFile.js | 100 | 100 | 100 | 100 | |
setup.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 | |
setup.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 | 85.71 | 100 | 50 | 100 | |
sum.js | 85.71 | 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 | 56.52 | 0 | 50 | 55.56 | |
Expand All @@ -56,20 +56,19 @@ All files | 56.52 | 0 | 50 | 55.56
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: <<REPLACED>>
Ran all test suites.
"
`;
exports[`outputs coverage report 1`] = `
"-------------------------------------|----------|----------|----------|----------|-------------------|
-------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-------------------------------------|----------|----------|----------|----------|-------------------|
All files | 56.52 | 0 | 50 | 55.56 | |
Expand All @@ -82,11 +81,11 @@ All files | 56.52 | 0 | 50 | 55.56
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 : 56.52% ( 13/23 )
Branches : 0% ( 0/4 )
Expand All @@ -106,11 +105,11 @@ All files | 56.52 | 0 | 50 | 55.56
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 | 56.52 | 0 | 50 | 55.56 | |
Expand All @@ -123,15 +122,15 @@ All files | 56.52 | 0 | 50 | 55.56
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 : 56.52% ( 13/23 )
Branches : 0% ( 0/4 )
Functions : 50% ( 3/6 )
Lines : 55.56% ( 10/18 )
================================================================================"
================================================================================
`;
Loading

0 comments on commit a0aff2e

Please sign in to comment.