Skip to content

Commit d6ff72a

Browse files
committed
chore: add node 12 to CI (#8411)
1 parent 7e9b4ea commit d6ff72a

File tree

6 files changed

+39
-10
lines changed

6 files changed

+39
-10
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ jobs:
7373
- store_test_results:
7474
path: reports/junit
7575

76-
test-node-11:
76+
test-node-12:
7777
working_directory: ~/jest
7878
docker:
79-
- image: circleci/node:11
79+
- image: circleci/node:12
8080
steps:
8181
- checkout
8282
- restore-cache: *restore-cache
@@ -120,8 +120,8 @@ workflows:
120120
- lint-and-typecheck
121121
- test-node-8
122122
- test-node-10
123+
- test-node-12 # current
123124
- test-jest-circus
124-
- test-node-11 # current
125125
- test-browser
126126
- test-or-deploy-website:
127127
filters: *filter-ignore-gh-pages

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Chore & Maintenance
1313

1414
- `[*]` [**BREAKING**] Drop support for Node 6 ([#8455](https://github.com/facebook/jest/pull/8455))
15+
- `[*]` Add Node 12 to CI ([#8411](https://github.com/facebook/jest/pull/8411))
1516
- `[docs]` Fix broken link pointing to legacy JS file in "Snapshot Testing".
1617
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade JSDOM from v11 to v15 ([#8851](https://github.com/facebook/jest/pull/8851))
1718

e2e/__tests__/__snapshots__/errorOnDeprecated.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FAIL __tests__/defaultTimeoutInterval.test.js
1616
12 | });
1717
13 |
1818
19-
at Object.<anonymous>.test (__tests__/defaultTimeoutInterval.test.js:10:3)
19+
at Object.<anonymous> (__tests__/defaultTimeoutInterval.test.js:10:3)
2020
`;
2121
2222
exports[`fail.test.js errors in errorOnDeprecated mode 1`] = `

e2e/__tests__/__snapshots__/failures.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ FAIL __tests__/duringTests.test.js
211211
40 |
212212
41 | test('done(non-error)', done => {
213213
214-
at Object.<anonymous>.done (__tests__/duringTests.test.js:38:8)
214+
at Object.<anonymous> (__tests__/duringTests.test.js:38:8)
215215
216216
● done(non-error)
217217

e2e/__tests__/errorOnDeprecated.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,31 @@ const SHOULD_NOT_PASS_IN_JEST = new Set([
3232
'spyOnProperty.test.js',
3333
]);
3434

35+
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
36+
3537
testFiles.forEach(testFile => {
3638
test(`${testFile} errors in errorOnDeprecated mode`, () => {
3739
const result = runJest('error-on-deprecated', [
3840
testFile,
3941
'--errorOnDeprecated',
4042
]);
4143
expect(result.status).toBe(1);
42-
const {rest} = extractSummary(result.stderr);
44+
let {rest} = extractSummary(result.stderr);
45+
46+
if (
47+
nodeMajorVersion < 12 &&
48+
testFile === 'defaultTimeoutInterval.test.js'
49+
) {
50+
const lineEntry = '(__tests__/defaultTimeoutInterval.test.js:10:3)';
51+
52+
expect(rest).toContain(`at Object.<anonymous>.test ${lineEntry}`);
53+
54+
rest = rest.replace(
55+
`at Object.<anonymous>.test ${lineEntry}`,
56+
`at Object.<anonymous> ${lineEntry}`,
57+
);
58+
}
59+
4360
expect(wrap(rest)).toMatchSnapshot();
4461
});
4562
});

e2e/__tests__/failures.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ function cleanStderr(stderr: string) {
2121
.replace(new RegExp('Failed: Object {', 'g'), 'thrown: Object {');
2222
}
2323

24+
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
25+
2426
beforeAll(() => {
2527
run('yarn', dir);
2628
});
@@ -36,17 +38,28 @@ test('not throwing Error objects', () => {
3638
stderr = runJest(dir, ['assertionCount.test.js']).stderr;
3739
expect(wrap(cleanStderr(stderr))).toMatchSnapshot();
3840
stderr = runJest(dir, ['duringTests.test.js']).stderr;
41+
42+
if (nodeMajorVersion < 12) {
43+
const lineEntry = '(__tests__/duringTests.test.js:38:8)';
44+
45+
expect(stderr).toContain(`at Object.<anonymous>.done ${lineEntry}`);
46+
47+
stderr = stderr.replace(
48+
`at Object.<anonymous>.done ${lineEntry}`,
49+
`at Object.<anonymous> ${lineEntry}`,
50+
);
51+
}
52+
3953
expect(wrap(cleanStderr(stderr))).toMatchSnapshot();
4054
});
4155

4256
test('works with node assert', () => {
43-
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
4457
const {stderr} = runJest(dir, ['assertionError.test.js']);
4558
let summary = normalizeDots(cleanStderr(stderr));
4659

4760
// Node 9 started to include the error for `doesNotThrow`
4861
// https://github.com/nodejs/node/pull/12167
49-
if (nodeMajorVersion >= 9) {
62+
if (nodeMajorVersion >= 10) {
5063
expect(summary).toContain(`
5164
assert.doesNotThrow(function)
5265
@@ -91,9 +104,7 @@ test('works with node assert', () => {
91104
expect(summary).toContain(specificErrorMessage);
92105
summary = summary.replace(specificErrorMessage, commonErrorMessage);
93106
}
94-
}
95107

96-
if (nodeMajorVersion >= 10) {
97108
const ifErrorMessage = `
98109
assert.ifError(received, expected)
99110

0 commit comments

Comments
 (0)