Skip to content

Commit 2be1b9e

Browse files
authored
feat: use Jest 30, drop old versions of Node (#358)
1 parent 6b4b567 commit 2be1b9e

File tree

17 files changed

+3637
-4969
lines changed

17 files changed

+3637
-4969
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@ on:
44
push:
55
branches:
66
- main
7+
- next
78
pull_request:
89
branches:
910
- '**'
11+
merge_group:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read # to fetch code (actions/checkout)
1019

1120
jobs:
1221
lint-and-typecheck:
1322
name: ESLint
1423
runs-on: ubuntu-latest
1524

1625
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
27+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
1928
with:
20-
node-version: 'lts/*'
29+
node-version: lts/*
2130
cache: yarn
2231
- name: install
2332
run: yarn
@@ -34,13 +43,15 @@ jobs:
3443
strategy:
3544
fail-fast: false
3645
matrix:
37-
node-version: [14.x, 16.x, 18.x, 19.x, 20.x]
46+
node-version: [18.x, 20.x, 22.x, 24.x]
3847
runs-on: ubuntu-latest
3948

4049
steps:
41-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
51+
with:
52+
persist-credentials: false
4253
- name: Use Node.js ${{ matrix.node-version }}
43-
uses: actions/setup-node@v4
54+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
4455
with:
4556
node-version: ${{ matrix.node-version }}
4657
cache: yarn
@@ -57,14 +68,16 @@ jobs:
5768
strategy:
5869
fail-fast: false
5970
matrix:
60-
os: [ubuntu-latest, windows-latest, macOS-latest]
71+
os: [windows-latest, macOS-latest]
6172
runs-on: ${{ matrix.os }}
6273

6374
steps:
64-
- uses: actions/checkout@v4
65-
- uses: actions/setup-node@v4
75+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
76+
with:
77+
persist-credentials: false
78+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
6679
with:
67-
node-version: 'lts/*'
80+
node-version: lts/*
6881
cache: yarn
6982
- name: install
7083
run: yarn

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ projects
33
yarn-error.log
44
build
55
coverage
6+
.eslintcache
67

78
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored
89
.yarn/*

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 0 additions & 541 deletions
This file was deleted.

.yarn/releases/yarn-3.8.7.cjs

Lines changed: 0 additions & 875 deletions
This file was deleted.

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@ enableGlobalCache: true
22

33
nodeLinker: node-modules
44

5-
plugins:
6-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
7-
spec: "@yarnpkg/plugin-interactive-tools"
8-
9-
yarnPath: .yarn/releases/yarn-3.8.7.cjs
5+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

babel.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable import/no-extraneous-dependencies */
2-
31
const semver = require('semver');
42
const pkg = require('./package.json');
53

eslint.config.mjs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { globalIgnores } from 'eslint/config';
2+
import jest from 'eslint-plugin-jest';
3+
import { importX } from 'eslint-plugin-import-x';
4+
import globals from 'globals';
5+
import eslint from '@eslint/js';
6+
import tseslint from 'typescript-eslint';
7+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
8+
9+
export default tseslint.config(
10+
globalIgnores(['**/build/']),
11+
eslint.configs.recommended,
12+
// eslint-disable-next-line import-x/no-named-as-default-member
13+
tseslint.configs.recommended,
14+
importX.flatConfigs.recommended,
15+
importX.flatConfigs.typescript,
16+
eslintPluginPrettierRecommended,
17+
{
18+
languageOptions: {
19+
globals: {
20+
...globals.node,
21+
...jest.environments.globals.globals,
22+
},
23+
},
24+
rules: {
25+
'import-x/no-extraneous-dependencies': [
26+
'error',
27+
{
28+
devDependencies: [
29+
'**/__tests__/**/*',
30+
'eslint.config.mjs',
31+
'babel.config.js',
32+
],
33+
},
34+
],
35+
'@typescript-eslint/no-import-type-side-effects': 'error',
36+
'@typescript-eslint/consistent-type-imports': [
37+
'error',
38+
{
39+
disallowTypeAnnotations: false,
40+
fixStyle: 'inline-type-imports',
41+
},
42+
],
43+
'@typescript-eslint/prefer-ts-expect-error': 'error',
44+
},
45+
},
46+
{
47+
files: ['integrationTests/__fixtures__/**/*'],
48+
49+
rules: {
50+
'no-console': 'off',
51+
},
52+
},
53+
{
54+
files: ['**/*.js'],
55+
56+
rules: {
57+
'@typescript-eslint/no-var-requires': 'off',
58+
'@typescript-eslint/no-require-imports': 'off',
59+
'@typescript-eslint/explicit-module-boundary-types': 'off',
60+
},
61+
},
62+
);

generator/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
2-
/* eslint-disable no-console */
32

43
const fs = require('fs');
54
const path = require('path');

integrationTests/runJest.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
2-
// eslint-disable-next-line import/no-extraneous-dependencies
2+
// eslint-disable-next-line import-x/no-extraneous-dependencies
33
const execa = require('execa');
4-
// eslint-disable-next-line import/no-extraneous-dependencies
4+
// eslint-disable-next-line import-x/no-extraneous-dependencies
55
const stripAnsi = require('strip-ansi');
66

77
const rootDir = path.resolve(__dirname, '..');
@@ -20,7 +20,6 @@ const normalize = output =>
2020
.replace(/\u221A/g, '\u2713');
2121

2222
const runJest = (project, options = []) => {
23-
// eslint-disable-next-line
2423
jest.setTimeout(15000);
2524
return execa(
2625
'jest',

integrationTests/runner/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line import/extensions, import/no-unresolved -- ignore build artifact
21
const { createJestRunner } = require('../..');
32

43
module.exports = createJestRunner(require.resolve('./run'));

integrationTests/runner/run.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const fs = require('fs');
2-
// eslint-disable-next-line import/extensions, import/no-unresolved -- ignore build artifact
32
const { pass, fail, skip, todo } = require('../..');
43

54
/** @type {import('../..').RunTest} */

lib/toTestResult.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ function getPerfStats({ stats }: Options): TestResult['perfStats'] {
2626
const runtime = end - start;
2727
// Note: this flag is set in 'lib/createJestRunner.ts'
2828
const slow = false;
29-
return { start, end, runtime, slow };
29+
return {
30+
start,
31+
end,
32+
runtime,
33+
slow,
34+
loadTestEnvironmentStart: 0,
35+
loadTestEnvironmentEnd: 0,
36+
setupAfterEnvStart: 0,
37+
setupAfterEnvEnd: 0,
38+
setupFilesStart: 0,
39+
setupFilesEnd: 0,
40+
};
3041
}
3142

3243
function getSnapshot(): TestResult['snapshot'] {

package.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,40 @@
3939
},
4040
"dependencies": {
4141
"chalk": "^4.1.0",
42-
"jest-worker": "^29.5.0",
42+
"jest-worker": "^30.0.0",
4343
"p-limit": "^3.1.0"
4444
},
4545
"devDependencies": {
4646
"@babel/cli": "^7.0.0",
4747
"@babel/core": "^7.0.0",
4848
"@babel/preset-env": "^7.0.0",
4949
"@babel/preset-typescript": "^7.0.0",
50-
"@jest/test-result": "^29.0.0",
50+
"@eslint/compat": "^1.3.0",
51+
"@eslint/eslintrc": "^3.3.1",
52+
"@eslint/js": "^9.29.0",
53+
"@jest/test-result": "^30.0.0",
5154
"@tsconfig/node14": "^14.0.0",
52-
"@types/node": "^14.18.23",
53-
"@typescript-eslint/eslint-plugin": "^6.0.0",
54-
"@typescript-eslint/parser": "^6.0.0",
55-
"babel-jest": "^29.0.0",
56-
"eslint": "^8.10.0",
57-
"eslint-config-airbnb-base": "^15.0.0",
55+
"@types/node": "^24.0.3",
56+
"babel-jest": "^30.0.0",
57+
"eslint": "^9.0.0",
5858
"eslint-config-prettier": "^10.0.0",
59-
"eslint-plugin-import": "^2.7.0",
60-
"eslint-plugin-jest": "^27.0.0",
61-
"eslint-plugin-prettier": "^4.0.0",
59+
"eslint-import-resolver-typescript": "^4.4.3",
60+
"eslint-plugin-import-x": "^4.15.2",
61+
"eslint-plugin-jest": "^29.0.0",
62+
"eslint-plugin-prettier": "^5.0.0",
6263
"execa": "^5.0.0",
63-
"jest": "^29.0.0",
64-
"jest-runner": "^29.0.0",
65-
"prettier": "^2.0.5",
64+
"globals": "^16.2.0",
65+
"jest": "^30.0.0",
66+
"jest-runner": "^30.0.0",
67+
"prettier": "^3.5.3",
6668
"semver": "^7.3.8",
6769
"strip-ansi": "^6.0.0",
68-
"typescript": "^5.0.0"
70+
"typescript": "^5.0.0",
71+
"typescript-eslint": "^8.0.0"
6972
},
7073
"peerDependencies": {
71-
"@jest/test-result": "^28.0.0 || ^29.0.0",
72-
"jest-runner": "^28.0.0 || ^29.0.0"
74+
"@jest/test-result": "^28.0.0 || ^29.0.0 || ^30.0.0",
75+
"jest-runner": "^28.0.0 || ^29.0.0 || ^30.0.0"
7376
},
7477
"peerDependenciesMeta": {
7578
"@jest/test-result": {
@@ -86,10 +89,10 @@
8689
"trailingComma": "all"
8790
},
8891
"resolutions": {
89-
"@types/node@*": "^14.18.23"
92+
"@types/node@*": "^18.0.0"
9093
},
9194
"engines": {
92-
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
95+
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
9396
},
94-
"packageManager": "yarn@3.8.7"
97+
"packageManager": "yarn@4.9.2"
9598
}

0 commit comments

Comments
 (0)