Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: drop node 10 and node 15 #12220

Merged
merged 6 commits into from Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -68,5 +68,5 @@ workflows:
partial: true
matrix:
parameters:
node-version: ['10', '12', '15', '16', '17']
node-version: ['12', '16', '17']
- test-jest-jasmine
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x, 15.x, 16.x, 17.x]
node-version: [12.x, 14.x, 16.x, 17.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: prepare-yarn-cache
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@

### Chore & Maintenance

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

### Performance

## 27.5.1
Expand Down
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap
Expand Up @@ -41,7 +41,7 @@ exports[`moduleNameMapper wrong array configuration 1`] = `
12 | module.exports = () => 'test';
13 |

at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:579:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:568:17)
at Object.require (index.js:10:1)"
`;

Expand Down Expand Up @@ -70,6 +70,6 @@ exports[`moduleNameMapper wrong configuration 1`] = `
12 | module.exports = () => 'test';
13 |

at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:579:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/resolver.js:568:17)
at Object.require (index.js:10:1)"
`;
Expand Up @@ -37,6 +37,6 @@ exports[`show error message with matching files 1`] = `
| ^
9 |

at Resolver.resolveModule (../../packages/jest-resolve/build/resolver.js:324:11)
at Resolver.resolveModule (../../packages/jest-resolve/build/resolver.js:317:11)
at Object.require (index.js:8:18)"
`;
16 changes: 1 addition & 15 deletions e2e/__tests__/consoleLogOutputWhenRunInBand.test.ts
Expand Up @@ -14,8 +14,6 @@ const DIR = path.resolve(__dirname, '../console-log-output-when-run-in-band');
beforeEach(() => cleanup(DIR));
afterAll(() => cleanup(DIR));

const nodeMajorVersion = Number(process.versions.node.split('.')[0]);

test('prints console.logs when run with forceExit', () => {
writeFiles(DIR, {
'__tests__/a-banana.js': `
Expand All @@ -24,26 +22,14 @@ test('prints console.logs when run with forceExit', () => {
'package.json': '{}',
});

const {stderr, exitCode, ...res} = runJest(DIR, [
const {stderr, stdout, exitCode} = runJest(DIR, [
'-i',
'--ci=false',
'--forceExit',
]);
let {stdout} = res;

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

if (nodeMajorVersion < 12) {
expect(stdout).toContain(
'at Object.<anonymous>.test (__tests__/a-banana.js:1:1)',
);

stdout = stdout.replace(
'at Object.<anonymous>.test (__tests__/a-banana.js:1:1)',
'at Object.<anonymous> (__tests__/a-banana.js:1:1)',
);
}

expect(exitCode).toBe(0);
expect(rest).toMatchSnapshot();
expect(summary).toMatchSnapshot();
Expand Down
35 changes: 15 additions & 20 deletions e2e/__tests__/detectOpenHandles.ts
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

import {onNodeVersions} from '@jest/test-utils';
import runJest, {runContinuous} from '../runJest';

try {
Expand Down Expand Up @@ -81,16 +80,14 @@ it('does not report crypto random data', () => {
expect(textAfterTest).toBe('');
});

onNodeVersions('>=12', () => {
it('does not report ELD histograms', () => {
const {stderr} = runJest('detect-open-handles', [
'histogram',
'--detectOpenHandles',
]);
const textAfterTest = getTextAfterTest(stderr);
it('does not report ELD histograms', () => {
const {stderr} = runJest('detect-open-handles', [
'histogram',
'--detectOpenHandles',
]);
const textAfterTest = getTextAfterTest(stderr);

expect(textAfterTest).toBe('');
});
expect(textAfterTest).toBe('');
});

describe('notify', () => {
Expand All @@ -109,17 +106,15 @@ describe('notify', () => {
});
});

onNodeVersions('>=12', () => {
it('does not report timeouts using unref', () => {
// The test here is basically that it exits cleanly without reporting anything (does not need `until`)
const {stderr} = runJest('detect-open-handles', [
'unref',
'--detectOpenHandles',
]);
const textAfterTest = getTextAfterTest(stderr);
it('does not report timeouts using unref', () => {
// The test here is basically that it exits cleanly without reporting anything (does not need `until`)
const {stderr} = runJest('detect-open-handles', [
'unref',
'--detectOpenHandles',
]);
const textAfterTest = getTextAfterTest(stderr);

expect(textAfterTest).toBe('');
});
expect(textAfterTest).toBe('');
});

it('prints out info about open handlers from inside tests', async () => {
Expand Down
18 changes: 1 addition & 17 deletions e2e/__tests__/errorOnDeprecated.test.ts
Expand Up @@ -31,30 +31,14 @@ 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', [
testFile,
'--errorOnDeprecated',
]);
expect(result.exitCode).toBe(1);
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.<anonymous>.test ${lineEntry}`);

rest = rest.replace(
`at Object.<anonymous>.test ${lineEntry}`,
`at Object.<anonymous> ${lineEntry}`,
);
}
const {rest} = extractSummary(result.stderr);

expect(rest).toMatchSnapshot();
});
Expand Down
14 changes: 0 additions & 14 deletions e2e/__tests__/failures.test.ts
Expand Up @@ -20,8 +20,6 @@ function cleanStderr(stderr: string) {
.replace(new RegExp('Failed: Object {', 'g'), 'thrown: Object {');
}

const nodeMajorVersion = Number(process.versions.node.split('.')[0]);

beforeAll(() => {
runYarnInstall(dir);
});
Expand All @@ -37,18 +35,6 @@ test('not throwing Error objects', () => {
stderr = runJest(dir, ['assertionCount.test.js']).stderr;
expect(cleanStderr(stderr)).toMatchSnapshot();
stderr = runJest(dir, ['duringTests.test.js']).stderr;

if (nodeMajorVersion < 12) {
const lineEntry = '(__tests__/duringTests.test.js:43:8)';

expect(stderr).toContain(`at Object.<anonymous>.done ${lineEntry}`);

stderr = stderr.replace(
`at Object.<anonymous>.done ${lineEntry}`,
`at Object.<anonymous> ${lineEntry}`,
);
}

expect(cleanStderr(stderr)).toMatchSnapshot();
stderr = runJest(dir, ['throwObjectWithStackProp.test.js']).stderr;
expect(cleanStderr(stderr)).toMatchSnapshot();
Expand Down
20 changes: 9 additions & 11 deletions e2e/__tests__/requireMainAfterCreateRequire.test.ts
Expand Up @@ -4,19 +4,17 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import * as path from 'path';
import {onNodeVersions} from '@jest/test-utils';
import runJest from '../runJest';

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

expect(stdout).toBe(
path.join(
__dirname,
'../require-main-after-create-require/__tests__/parent.test.js',
),
);
});
expect(stdout).toBe(
path.join(
__dirname,
'../require-main-after-create-require/__tests__/parent.test.js',
),
);
});
11 changes: 3 additions & 8 deletions e2e/__tests__/unexpectedToken.test.ts
Expand Up @@ -11,7 +11,6 @@ import {cleanup, writeFiles} from '../Utils';
import runJest from '../runJest';

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

beforeEach(() => cleanup(DIR));
afterEach(() => cleanup(DIR));
Expand Down Expand Up @@ -53,13 +52,9 @@ test('triggers unexpected token error message for untranspiled node_modules', ()
expect(stdout).toBe('');
expect(stderr).toMatch(/Jest encountered an unexpected token/);
expect(stderr).toMatch(/import {module}/);
if (nodeMajorVersion < 12) {
expect(stderr).toMatch(/Unexpected token/);
} else {
expect(stderr).toMatch(
/SyntaxError: Cannot use import statement outside a module/,
);
}
expect(stderr).toMatch(
/SyntaxError: Cannot use import statement outside a module/,
);
});

test('does not trigger unexpected token error message for regular syntax errors', () => {
Expand Down
5 changes: 1 addition & 4 deletions jest.config.js
Expand Up @@ -34,10 +34,7 @@ module.exports = {
snapshotFormat: {
escapeString: false,
},
snapshotSerializers: [
// change to require.resolve('pretty-format/ConvertAnsi') when we drop Node 10
'<rootDir>/packages/pretty-format/build/plugins/ConvertAnsi.js',
],
snapshotSerializers: [require.resolve('pretty-format/ConvertAnsi')],
testPathIgnorePatterns: [
'/__arbitraries__/',
'/__typetests__/',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -12,14 +12,14 @@
"@crowdin/cli": "^3.5.2",
"@jest/globals": "workspace:*",
"@jest/test-utils": "workspace:*",
"@tsconfig/node10": "^1.0.8",
"@tsconfig/node12": "^1.0.9",
"@tsd/typescript": "~4.1.5",
"@types/babel__core": "^7.0.0",
"@types/babel__generator": "^7.0.0",
"@types/babel__template": "^7.0.0",
"@types/dedent": "0.7.0",
"@types/jest": "^26.0.15",
"@types/node": "~10.14.0",
"@types/node": "~12.12.0",
"@types/which": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
Expand Down Expand Up @@ -145,7 +145,7 @@
"logo": "https://opencollective.com/jest/logo.txt"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"resolutions": {
"@jest/create-cache-key-function": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/package.json
Expand Up @@ -36,7 +36,7 @@
"@babel/core": "^7.8.0"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/package.json
Expand Up @@ -7,7 +7,7 @@
"directory": "packages/babel-plugin-jest-hoist"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"license": "MIT",
"main": "./build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-jest/package.json
Expand Up @@ -20,7 +20,7 @@
"@babel/core": "^7.0.0"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/diff-sequences/package.json
Expand Up @@ -16,7 +16,7 @@
"diff"
],
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/package.json
Expand Up @@ -33,7 +33,7 @@
"tsd-lite": "^0.5.1"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-changed-files/package.json
Expand Up @@ -22,7 +22,7 @@
"throat": "^6.0.1"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/package.json
Expand Up @@ -49,7 +49,7 @@
"graceful-fs": "^4.2.9"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Expand Up @@ -44,7 +44,7 @@
"jest": "./bin/jest.js"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/package.json
Expand Up @@ -59,7 +59,7 @@
"typescript": "^4.0.3"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/package.json
Expand Up @@ -29,7 +29,7 @@
"@types/node": "*"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Expand Up @@ -58,7 +58,7 @@
}
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
},
"repository": {
"type": "git",
Expand Down