Skip to content

Commit fd3adba

Browse files
committed
chore: drop node 10 and node 15
1 parent 9bcd565 commit fd3adba

File tree

65 files changed

+130
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+130
-191
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ workflows:
7070
partial: true
7171
matrix:
7272
parameters:
73-
node-version: ['10', '12', '15', '16', '17']
73+
node-version: ['12', '16', '17']
7474
- test-jest-jasmine

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
strategy:
7070
fail-fast: false
7171
matrix:
72-
node-version: [10.x, 12.x, 14.x, 15.x, 16.x, 17.x]
72+
node-version: [12.x, 14.x, 16.x, 17.x]
7373
os: [ubuntu-latest, macOS-latest, windows-latest]
7474
runs-on: ${{ matrix.os }}
7575
needs: prepare-yarn-cache

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Chore & Maintenance
88

9+
- `[*]` Drop support for Node v10 and v15 and target first LTS `16.13.0` ([#12220](https://github.com/facebook/jest/pull/12220))
10+
911
### Performance
1012

1113
## 27.5.0

e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const DIR = path.resolve(__dirname, '../console-log-output-when-run-in-band');
1515
beforeEach(() => cleanup(DIR));
1616
afterAll(() => cleanup(DIR));
1717

18-
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
19-
2018
test('prints console.logs when run with forceExit', () => {
2119
writeFiles(DIR, {
2220
'__tests__/a-banana.js': `
@@ -25,26 +23,14 @@ test('prints console.logs when run with forceExit', () => {
2523
'package.json': '{}',
2624
});
2725

28-
const {stderr, exitCode, ...res} = runJest(DIR, [
26+
const {stderr, stdout, exitCode} = runJest(DIR, [
2927
'-i',
3028
'--ci=false',
3129
'--forceExit',
3230
]);
33-
let {stdout} = res;
3431

3532
const {rest, summary} = extractSummary(stderr);
3633

37-
if (nodeMajorVersion < 12) {
38-
expect(stdout).toContain(
39-
'at Object.<anonymous>.test (__tests__/a-banana.js:1:1)',
40-
);
41-
42-
stdout = stdout.replace(
43-
'at Object.<anonymous>.test (__tests__/a-banana.js:1:1)',
44-
'at Object.<anonymous> (__tests__/a-banana.js:1:1)',
45-
);
46-
}
47-
4834
expect(exitCode).toBe(0);
4935
expect(wrap(rest)).toMatchSnapshot();
5036
expect(wrap(summary)).toMatchSnapshot();

e2e/__tests__/detectOpenHandles.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import {wrap} from 'jest-snapshot-serializer-raw';
9-
import {onNodeVersions} from '@jest/test-utils';
109
import runJest, {runContinuous} from '../runJest';
1110

1211
try {
@@ -82,16 +81,14 @@ it('does not report crypto random data', () => {
8281
expect(textAfterTest).toBe('');
8382
});
8483

85-
onNodeVersions('>=12', () => {
86-
it('does not report ELD histograms', () => {
87-
const {stderr} = runJest('detect-open-handles', [
88-
'histogram',
89-
'--detectOpenHandles',
90-
]);
91-
const textAfterTest = getTextAfterTest(stderr);
84+
it('does not report ELD histograms', () => {
85+
const {stderr} = runJest('detect-open-handles', [
86+
'histogram',
87+
'--detectOpenHandles',
88+
]);
89+
const textAfterTest = getTextAfterTest(stderr);
9290

93-
expect(textAfterTest).toBe('');
94-
});
91+
expect(textAfterTest).toBe('');
9592
});
9693

9794
describe('notify', () => {
@@ -110,17 +107,15 @@ describe('notify', () => {
110107
});
111108
});
112109

113-
onNodeVersions('>=12', () => {
114-
it('does not report timeouts using unref', () => {
115-
// The test here is basically that it exits cleanly without reporting anything (does not need `until`)
116-
const {stderr} = runJest('detect-open-handles', [
117-
'unref',
118-
'--detectOpenHandles',
119-
]);
120-
const textAfterTest = getTextAfterTest(stderr);
110+
it('does not report timeouts using unref', () => {
111+
// The test here is basically that it exits cleanly without reporting anything (does not need `until`)
112+
const {stderr} = runJest('detect-open-handles', [
113+
'unref',
114+
'--detectOpenHandles',
115+
]);
116+
const textAfterTest = getTextAfterTest(stderr);
121117

122-
expect(textAfterTest).toBe('');
123-
});
118+
expect(textAfterTest).toBe('');
124119
});
125120

126121
it('prints out info about open handlers from inside tests', async () => {

e2e/__tests__/errorOnDeprecated.test.ts

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

35-
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
36-
3735
testFiles.forEach(testFile => {
3836
test(`${testFile} errors in errorOnDeprecated mode`, () => {
3937
const result = runJest('error-on-deprecated', [
4038
testFile,
4139
'--errorOnDeprecated',
4240
]);
4341
expect(result.exitCode).toBe(1);
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-
}
42+
const {rest} = extractSummary(result.stderr);
5943

6044
expect(wrap(rest)).toMatchSnapshot();
6145
});

e2e/__tests__/failures.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ 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-
2624
beforeAll(() => {
2725
runYarnInstall(dir);
2826
});
@@ -38,18 +36,6 @@ test('not throwing Error objects', () => {
3836
stderr = runJest(dir, ['assertionCount.test.js']).stderr;
3937
expect(wrap(cleanStderr(stderr))).toMatchSnapshot();
4038
stderr = runJest(dir, ['duringTests.test.js']).stderr;
41-
42-
if (nodeMajorVersion < 12) {
43-
const lineEntry = '(__tests__/duringTests.test.js:43: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-
5339
expect(wrap(cleanStderr(stderr))).toMatchSnapshot();
5440
stderr = runJest(dir, ['throwObjectWithStackProp.test.js']).stderr;
5541
expect(wrap(cleanStderr(stderr))).toMatchSnapshot();

e2e/__tests__/requireMainAfterCreateRequire.test.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
7+
78
import * as path from 'path';
8-
import {onNodeVersions} from '@jest/test-utils';
99
import runJest from '../runJest';
1010

11-
onNodeVersions('>=12.2.0', () => {
12-
test('`require.main` not undefined after createRequire', () => {
13-
const {stdout} = runJest('require-main-after-create-require');
11+
test('`require.main` not undefined after createRequire', () => {
12+
const {stdout} = runJest('require-main-after-create-require');
1413

15-
expect(stdout).toBe(
16-
path.join(
17-
__dirname,
18-
'../require-main-after-create-require/__tests__/parent.test.js',
19-
),
20-
);
21-
});
14+
expect(stdout).toBe(
15+
path.join(
16+
__dirname,
17+
'../require-main-after-create-require/__tests__/parent.test.js',
18+
),
19+
);
2220
});

e2e/__tests__/unexpectedToken.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {cleanup, writeFiles} from '../Utils';
1111
import runJest from '../runJest';
1212

1313
const DIR = path.resolve(tmpdir(), 'unexpected-token');
14-
const nodeMajorVersion = Number(process.versions.node.split('.')[0]);
1514

1615
beforeEach(() => cleanup(DIR));
1716
afterEach(() => cleanup(DIR));
@@ -51,13 +50,9 @@ test('triggers unexpected token error message for untranspiled node_modules', ()
5150
expect(stdout).toBe('');
5251
expect(stderr).toMatch(/Jest encountered an unexpected token/);
5352
expect(stderr).toMatch(/import {module}/);
54-
if (nodeMajorVersion < 12) {
55-
expect(stderr).toMatch(/Unexpected token/);
56-
} else {
57-
expect(stderr).toMatch(
58-
/SyntaxError: Cannot use import statement outside a module/,
59-
);
60-
}
53+
expect(stderr).toMatch(
54+
/SyntaxError: Cannot use import statement outside a module/,
55+
);
6156
});
6257

6358
test('does not trigger unexpected token error message for regular syntax errors', () => {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"@crowdin/cli": "^3.5.2",
1414
"@jest/globals": "workspace:*",
1515
"@jest/test-utils": "workspace:*",
16-
"@tsconfig/node10": "^1.0.8",
16+
"@tsconfig/node12": "^1.0.9",
1717
"@tsd/typescript": "~4.1.5",
1818
"@types/babel__core": "^7.0.0",
1919
"@types/babel__generator": "^7.0.0",
2020
"@types/babel__template": "^7.0.0",
2121
"@types/dedent": "0.7.0",
2222
"@types/jest": "^26.0.15",
23-
"@types/node": "~10.14.0",
23+
"@types/node": "~12.12.0",
2424
"@types/which": "^2.0.0",
2525
"@typescript-eslint/eslint-plugin": "^4.1.0",
2626
"@typescript-eslint/parser": "^4.1.0",
@@ -147,7 +147,7 @@
147147
"logo": "https://opencollective.com/jest/logo.txt"
148148
},
149149
"engines": {
150-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
150+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
151151
},
152152
"resolutions": {
153153
"@jest/create-cache-key-function": "workspace:*",

packages/babel-jest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@babel/core": "^7.8.0"
3737
},
3838
"engines": {
39-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
39+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
4040
},
4141
"publishConfig": {
4242
"access": "public"

packages/babel-plugin-jest-hoist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"directory": "packages/babel-plugin-jest-hoist"
88
},
99
"engines": {
10-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
10+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
1111
},
1212
"license": "MIT",
1313
"main": "./build/index.js",

packages/babel-preset-jest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@babel/core": "^7.0.0"
2121
},
2222
"engines": {
23-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
23+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
2424
},
2525
"publishConfig": {
2626
"access": "public"

packages/diff-sequences/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"diff"
1717
],
1818
"engines": {
19-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
19+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
2020
},
2121
"main": "./build/index.js",
2222
"types": "./build/index.d.ts",

packages/expect/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"tsd-lite": "^0.5.1"
3434
},
3535
"engines": {
36-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
36+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
3737
},
3838
"publishConfig": {
3939
"access": "public"

packages/jest-changed-files/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"throat": "^6.0.1"
2323
},
2424
"engines": {
25-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
25+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
2626
},
2727
"publishConfig": {
2828
"access": "public"

packages/jest-circus/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"jest-snapshot-serializer-raw": "^1.1.0"
5151
},
5252
"engines": {
53-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
53+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
5454
},
5555
"publishConfig": {
5656
"access": "public"

packages/jest-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"jest": "./bin/jest.js"
4545
},
4646
"engines": {
47-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
47+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
4848
},
4949
"repository": {
5050
"type": "git",

packages/jest-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"typescript": "^4.0.3"
6060
},
6161
"engines": {
62-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
62+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
6363
},
6464
"publishConfig": {
6565
"access": "public"

packages/jest-console/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@types/node": "*"
3030
},
3131
"engines": {
32-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
32+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
3333
},
3434
"publishConfig": {
3535
"access": "public"

packages/jest-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060
},
6161
"engines": {
62-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
62+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
6363
},
6464
"repository": {
6565
"type": "git",

packages/jest-core/src/collectHandles.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function stackIsFromUser(stack: string) {
4040

4141
const alwaysActive = () => true;
4242

43-
// @ts-expect-error: doesn't exist in v10 typings
43+
// @ts-expect-error: doesn't exist in v12 typings
4444
const hasWeakRef = typeof WeakRef === 'function';
4545

4646
const asyncSleep = promisify(setTimeout);
@@ -97,13 +97,12 @@ export default function collectHandles(): HandleCollectionResult {
9797
// Timer that supports hasRef (Node v11+)
9898
if ('hasRef' in resource) {
9999
if (hasWeakRef) {
100-
// @ts-expect-error: doesn't exist in v10 typings
100+
// @ts-expect-error: doesn't exist in v12 typings
101101
const ref = new WeakRef(resource);
102102
isActive = () => {
103103
return ref.deref()?.hasRef() ?? false;
104104
};
105105
} else {
106-
// @ts-expect-error: doesn't exist in v10 typings
107106
isActive = resource.hasRef.bind(resource);
108107
}
109108
} else {

packages/jest-create-cache-key-function/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"jest-util": "^27.5.0"
1515
},
1616
"engines": {
17-
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
17+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
1818
},
1919
"license": "MIT",
2020
"main": "./build/index.js",

0 commit comments

Comments
 (0)