Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat/use-transfor…
Browse files Browse the repository at this point in the history
…m-runtime

* upstream/master:
  add missing truncate comment to recent blog posts (jestjs#7655)
  use raw serializer for e2e output snapshots (jestjs#7651)
  chore: use a Set for reserved words list in `jest-mock`
  Fix automock for numeric function names (jestjs#7653)
  Update docs re: `moduleFileExtensions` to add ordering note (left-to-right) (jestjs#7616)
  • Loading branch information
thymikee committed Jan 20, 2019
2 parents 45e525a + 5fc391f commit df4350f
Show file tree
Hide file tree
Showing 179 changed files with 937 additions and 1,156 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

### Fixes

- `[jest-mock]` Fix automock for numeric function names ([#7653](https://github.com/facebook/jest/pull/7653))
- `[jest-config]` Ensure `existsSync` is only called with a string parameter ([#7607](https://github.com/facebook/jest/pull/7607))
- `[expect]` `toStrictEqual` considers sparseness of arrays. ([#7591](https://github.com/facebook/jest/pull/7591))
- `[jest-cli]` Fix empty coverage data for untested files ([#7388](https://github.com/facebook/jest/pull/7388))
Expand Down
4 changes: 3 additions & 1 deletion docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ An array of directory names to be searched recursively up from the requiring mod

Default: `["js", "json", "jsx", "ts", "tsx", "node"]`

An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for.
An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.

We recommend placing the extensions most commonly used in your project on the left, so if you are using TypeScript, you may want to consider moving "ts" and/or "tsx" to the beginning of the array.

### `moduleNameMapper` [object<string, string>]

Expand Down
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 df4350f

Please sign in to comment.