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 8 support #9423

Merged
merged 19 commits into from
May 2, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@ aliases:

version: 2
jobs:
test-node-8:
working_directory: ~/jest
docker:
- image: circleci/node:8
steps:
- checkout
- run:
command: yarn remove-prettier-dep
- restore-cache: *restore-cache
- run: *install
- save-cache: *save-cache
- run:
command: yarn test-ci-partial
- store_test_results:
path: reports/junit

test-node-10:
working_directory: ~/jest
docker:
Expand Down Expand Up @@ -123,7 +107,6 @@ workflows:
version: 2
build-and-deploy:
jobs:
- test-node-8
- test-node-10
- test-node-12
- test-node-13
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# https://github.com/actions/setup-node/issues/27
node-version: [8.17.0, 10.x, 12.x, 13.x, 14.x]
node-version: [10.x, 12.x, 13.x, 14.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Chore & Maintenance

- `[*]` [**BREAKING**] TypeScript definitions requires a minimum of TypeScript v3.8 ([#9823](https://github.com/facebook/jest/pull/9823))
- `[*]` [**BREAKING**] Drop support for Node 8 ([#9423](https://github.com/facebook/jest/pull/9423))
- `[jest-runtime]` [**BREAKING**] Remove long-deprecated `require.requireActual` and `require.requireMock` methods ([#9854](https://github.com/facebook/jest/pull/9854))
- `[expect, jest-mock, pretty-format]` [**BREAKING**] Remove `build-es5` from package ([#9945](https://github.com/facebook/jest/pull/9945))
- `[jest-haste-map]` [**BREAKING**] removed `providesModuleNodeModules` ([#8535](https://github.com/facebook/jest/pull/8535))
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
},
],
],
test: 'packages/jest-config/src/importEsm.ts',
test: 'packages/jest-config/src/readConfigFileAndSetRootDir.ts',
},
],
plugins: [
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"lint:prettier:ci": "prettier '**/*.{md,yml,yaml}' 'website/static/**/*.{css,js}' --check --ignore-path .gitignore",
"postinstall": "opencollective postinstall && yarn build",
"install-no-ts-build": "node ./scripts/remove-postinstall && yarn --no-progress --frozen-lockfile && node ./scripts/build",
"remove-prettier-dep": "node ./scripts/remove-prettier-dep",
"publish": "yarn build-clean && yarn build && lerna publish --silent",
"test-ci": "yarn jest-coverage --color -i --config jest.config.ci.js && yarn test-leak && node ./scripts/mapCoverage.js && codecov",
"test-ci-partial": "yarn jest --color -i --config jest.config.ci.js",
Expand Down Expand Up @@ -132,6 +131,6 @@
"logo": "https://opencollective.com/jest/logo.txt"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
}
}
2 changes: 1 addition & 1 deletion packages/babel-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@babel/core": "^7.0.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "packages/babel-plugin-jest-hoist"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"license": "MIT",
"main": "build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@babel/core": "^7.0.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/diff-sequences/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"diff"
],
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-fb-strict/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint-plugin-react": "^7.1.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"immutable": "^4.0.0-rc.12"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2022,11 +2022,11 @@ exports[`.toEqual() {pass: false} expect("type TypeName<T> = T extends Function
<r>+ type TypeName<T> = T extends Function<i> </i>? "function"<i> </i>: "object";</>
`;

exports[`.toEqual() {pass: false} expect(/abc/gy).toEqual(/abc/g) 1`] = `
exports[`.toEqual() {pass: false} expect(/abc/gsy).toEqual(/abc/g) 1`] = `
<d>expect(</><r>received</><d>).</>toEqual<d>(</><g>expected</><d>) // deep equality</>

Expected: <g>/abc/g</>
Received: <r>/abc/gy</>
Received: <r>/abc/gsy</>
`;

exports[`.toEqual() {pass: false} expect([1, 2]).toEqual([2, 1]) 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-changed-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"throat": "^5.0.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"graceful-fs": "^4.2.4"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"jest": "./bin/jest.js"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/micromatch": "^4.0.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-config/src/__tests__/Defaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import {defaults} from '../index';

jest.mock('../importEsm', () => (s: string) => import(s));

test('get configuration defaults', () => {
expect(defaults).toBeDefined();
});
2 changes: 0 additions & 2 deletions packages/jest-config/src/__tests__/readConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import {readConfig} from '../index';

jest.mock('../importEsm', () => (s: string) => import(s));

test('readConfig() throws when an object is passed without a file path', async () => {
await expect(
readConfig(
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-config/src/__tests__/readConfigs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import {readConfigs} from '../index';

jest.mock('../importEsm', () => (s: string) => import(s));

test('readConfigs() throws when called without project paths', async () => {
await expect(
// @ts-ignore
Expand Down
14 changes: 0 additions & 14 deletions packages/jest-config/src/importEsm.ts

This file was deleted.

7 changes: 5 additions & 2 deletions packages/jest-config/src/readConfigFileAndSetRootDir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import * as path from 'path';
import {pathToFileURL} from 'url';
import * as fs from 'graceful-fs';
import type {Config} from '@jest/types';
// @ts-ignore: vendored
import jsonlint from './vendor/jsonlint';
import {JEST_CONFIG_EXT_JSON, PACKAGE_JSON} from './constants';
import importEsm from './importEsm';

// Read the configuration and set its `rootDir`
// 1. If it's a `package.json` file, we look into its "jest" property
Expand All @@ -28,7 +28,10 @@ export default async function readConfigFileAndSetRootDir(
} catch (error) {
if (error.code === 'ERR_REQUIRE_ESM') {
try {
const importedConfig = await importEsm(configPath);
const configUrl = pathToFileURL(configPath);

// node `import()` supports URL, but TypeScript doesn't know that
const importedConfig = await import(configUrl.href);

if (!importedConfig.default) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"jest-snapshot-serializer-raw": "^1.1.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-docblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-each/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"pretty-format": "^25.5.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-environment-jsdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/jsdom": "^12.2.4"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 2 additions & 6 deletions packages/jest-environment-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@
"@jest/fake-timers": "^25.5.0",
"@jest/types": "^25.5.0",
"jest-mock": "^25.5.0",
"jest-util": "^25.5.0",
"semver": "^6.3.0"
},
"devDependencies": {
"@types/semver": "^6.2.1"
"jest-util": "^25.5.0"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 0 additions & 8 deletions packages/jest-environment-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
LolexFakeTimers,
} from '@jest/fake-timers';
import type {JestEnvironment} from '@jest/environment';
import {lt as semverLt} from 'semver';

type Timer = {
id: number;
Expand Down Expand Up @@ -122,11 +121,4 @@ class NodeEnvironment implements JestEnvironment {
}
}

// node 10 had a bug in `vm.compileFunction` that was fixed in https://github.com/nodejs/node/pull/23206.
// Let's just pretend the env doesn't support the function.
// Make sure engine requirement is high enough when we drop node 8 so we can remove this condition
if (semverLt(process.version, '10.14.2')) {
delete NodeEnvironment.prototype.getVmContext;
}

export = NodeEnvironment;
2 changes: 1 addition & 1 deletion packages/jest-environment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-fake-timers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-get-type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"directory": "packages/jest-get-type"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"license": "MIT",
"main": "build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-globals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "packages/jest-globals"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"license": "MIT",
"main": "build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"fsevents": "^2.1.2"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/co": "^4.6.2"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-leak-detector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"weak-napi": "^1.0.3"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down
Loading