Skip to content

Commit

Permalink
chore: drop node 8 support (#9423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha committed May 2, 2020
1 parent 37a9402 commit 56782b9
Show file tree
Hide file tree
Showing 61 changed files with 61 additions and 108 deletions.
17 changes: 0 additions & 17 deletions .circleci/config.yml
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Expand Up @@ -18,7 +18,7 @@
"weak-napi": "^1.0.3"
},
"engines": {
"node": ">= 8.3"
"node": ">= 10.14.2"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 56782b9

Please sign in to comment.