diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ce011e708a8..7b056fa95d55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,10 +73,10 @@ jobs: - store_test_results: path: reports/junit - test-node-11: + test-node-12: working_directory: ~/jest docker: - - image: circleci/node:11 + - image: circleci/node:12 steps: - checkout - restore-cache: *restore-cache @@ -120,8 +120,8 @@ workflows: - lint-and-typecheck - test-node-8 - test-node-10 + - test-node-12 # current - test-jest-circus - - test-node-11 # current - test-browser - test-or-deploy-website: filters: *filter-ignore-gh-pages diff --git a/CHANGELOG.md b/CHANGELOG.md index 1533e88687e8..1b9f8e831c60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,14 @@ - `[expect]` Display expectedDiff more carefully in toBeCloseTo ([#8389](https://github.com/facebook/jest/pull/8389)) - `[jest-fake-timers]` `getTimerCount` will not include cancelled immediates ([#8764](https://github.com/facebook/jest/pull/8764)) +- `[jest-leak-detector]` [**BREAKING**] Use `weak-napi` instead of `weak` package ([#8686](https://github.com/facebook/jest/pull/8686)) ### Chore & Maintenance - `[*]` [**BREAKING**] Drop support for Node 6 ([#8455](https://github.com/facebook/jest/pull/8455)) +- `[*]` Add Node 12 to CI ([#8411](https://github.com/facebook/jest/pull/8411)) - `[docs]` Fix broken link pointing to legacy JS file in "Snapshot Testing". - `[jest-environment-jsdom]` [**BREAKING**] Upgrade JSDOM from v11 to v15 ([#8851](https://github.com/facebook/jest/pull/8851)) -- `[jest-leak-detector]` [**BREAKING**] Use `weak-napi` instead of `weak` package ([#8686](https://github.com/facebook/jest/pull/8686)) ### Performance diff --git a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap index 9ca3c1100c97..613a80ca77b8 100644 --- a/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap +++ b/e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap @@ -16,7 +16,7 @@ FAIL __tests__/defaultTimeoutInterval.test.js 12 | }); 13 | - at Object..test (__tests__/defaultTimeoutInterval.test.js:10:3) + at Object. (__tests__/defaultTimeoutInterval.test.js:10:3) `; exports[`fail.test.js errors in errorOnDeprecated mode 1`] = ` diff --git a/e2e/__tests__/__snapshots__/failures.test.ts.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap index a2e434a385c4..02d7fa1921df 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -211,7 +211,7 @@ FAIL __tests__/duringTests.test.js 40 | 41 | test('done(non-error)', done => { - at Object..done (__tests__/duringTests.test.js:38:8) + at Object. (__tests__/duringTests.test.js:38:8) ● done(non-error) diff --git a/e2e/__tests__/errorOnDeprecated.test.ts b/e2e/__tests__/errorOnDeprecated.test.ts index f13846fd7ae8..5eae6b117a23 100644 --- a/e2e/__tests__/errorOnDeprecated.test.ts +++ b/e2e/__tests__/errorOnDeprecated.test.ts @@ -32,6 +32,8 @@ const SHOULD_NOT_PASS_IN_JEST = new Set([ 'spyOnProperty.test.js', ]); +const nodeMajorVersion = Number(process.versions.node.split('.')[0]); + testFiles.forEach(testFile => { test(`${testFile} errors in errorOnDeprecated mode`, () => { const result = runJest('error-on-deprecated', [ @@ -39,7 +41,22 @@ testFiles.forEach(testFile => { '--errorOnDeprecated', ]); expect(result.status).toBe(1); - const {rest} = extractSummary(result.stderr); + let {rest} = extractSummary(result.stderr); + + if ( + nodeMajorVersion < 12 && + testFile === 'defaultTimeoutInterval.test.js' + ) { + const lineEntry = '(__tests__/defaultTimeoutInterval.test.js:10:3)'; + + expect(rest).toContain(`at Object..test ${lineEntry}`); + + rest = rest.replace( + `at Object..test ${lineEntry}`, + `at Object. ${lineEntry}`, + ); + } + expect(wrap(rest)).toMatchSnapshot(); }); }); diff --git a/e2e/__tests__/failures.test.ts b/e2e/__tests__/failures.test.ts index 9b38aa04d35e..dd7aec60d2ee 100644 --- a/e2e/__tests__/failures.test.ts +++ b/e2e/__tests__/failures.test.ts @@ -21,6 +21,8 @@ function cleanStderr(stderr: string) { .replace(new RegExp('Failed: Object {', 'g'), 'thrown: Object {'); } +const nodeMajorVersion = Number(process.versions.node.split('.')[0]); + beforeAll(() => { run('yarn', dir); }); @@ -36,17 +38,28 @@ test('not throwing Error objects', () => { stderr = runJest(dir, ['assertionCount.test.js']).stderr; expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); stderr = runJest(dir, ['duringTests.test.js']).stderr; + + if (nodeMajorVersion < 12) { + const lineEntry = '(__tests__/duringTests.test.js:38:8)'; + + expect(stderr).toContain(`at Object..done ${lineEntry}`); + + stderr = stderr.replace( + `at Object..done ${lineEntry}`, + `at Object. ${lineEntry}`, + ); + } + expect(wrap(cleanStderr(stderr))).toMatchSnapshot(); }); test('works with node assert', () => { - const nodeMajorVersion = Number(process.versions.node.split('.')[0]); const {stderr} = runJest(dir, ['assertionError.test.js']); let summary = normalizeDots(cleanStderr(stderr)); // Node 9 started to include the error for `doesNotThrow` // https://github.com/nodejs/node/pull/12167 - if (nodeMajorVersion >= 9) { + if (nodeMajorVersion >= 10) { expect(summary).toContain(` assert.doesNotThrow(function) @@ -91,9 +104,7 @@ test('works with node assert', () => { expect(summary).toContain(specificErrorMessage); summary = summary.replace(specificErrorMessage, commonErrorMessage); } - } - if (nodeMajorVersion >= 10) { const ifErrorMessage = ` assert.ifError(received, expected)