Skip to content

feat: use Jest 30, drop old versions of Node #358

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

Merged
merged 3 commits into from
Jun 19, 2025
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

55 changes: 0 additions & 55 deletions .eslintrc.json

This file was deleted.

33 changes: 23 additions & 10 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@ on:
push:
branches:
- main
- next
pull_request:
branches:
- '**'
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
lint-and-typecheck:
name: ESLint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
with:
node-version: 'lts/*'
node-version: lts/*
cache: yarn
- name: install
run: yarn
Expand All @@ -34,13 +43,15 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x, 19.x, 20.x]
node-version: [18.x, 20.x, 22.x, 24.x]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand All @@ -57,14 +68,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.0
with:
node-version: 'lts/*'
node-version: lts/*
cache: yarn
- name: install
run: yarn
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ projects
yarn-error.log
build
coverage
.eslintcache

# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored
.yarn/*
Expand Down
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.8.7.cjs

This file was deleted.

942 changes: 942 additions & 0 deletions .yarn/releases/yarn-4.9.2.cjs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ enableGlobalCache: true

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.8.7.cjs
yarnPath: .yarn/releases/yarn-4.9.2.cjs
2 changes: 0 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */

const semver = require('semver');
const pkg = require('./package.json');

Expand Down
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { globalIgnores } from 'eslint/config';
import jest from 'eslint-plugin-jest';
import { importX } from 'eslint-plugin-import-x';
import globals from 'globals';
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config(
globalIgnores(['**/build/']),
eslint.configs.recommended,
// eslint-disable-next-line import-x/no-named-as-default-member
tseslint.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
...jest.environments.globals.globals,
},
},
rules: {
'import-x/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/__tests__/**/*',
'eslint.config.mjs',
'babel.config.js',
],
},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
disallowTypeAnnotations: false,
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/prefer-ts-expect-error': 'error',
},
},
{
files: ['integrationTests/__fixtures__/**/*'],

rules: {
'no-console': 'off',
},
},
{
files: ['**/*.js'],

rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
);
1 change: 0 additions & 1 deletion generator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node
/* eslint-disable no-console */

const fs = require('fs');
const path = require('path');
Expand Down
5 changes: 2 additions & 3 deletions integrationTests/runJest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
// eslint-disable-next-line import-x/no-extraneous-dependencies
const execa = require('execa');
// eslint-disable-next-line import/no-extraneous-dependencies
// eslint-disable-next-line import-x/no-extraneous-dependencies
const stripAnsi = require('strip-ansi');

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

const runJest = (project, options = []) => {
// eslint-disable-next-line
jest.setTimeout(15000);
return execa(
'jest',
Expand Down
1 change: 0 additions & 1 deletion integrationTests/runner/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/extensions, import/no-unresolved -- ignore build artifact
const { createJestRunner } = require('../..');

module.exports = createJestRunner(require.resolve('./run'));
1 change: 0 additions & 1 deletion integrationTests/runner/run.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const fs = require('fs');
// eslint-disable-next-line import/extensions, import/no-unresolved -- ignore build artifact
const { pass, fail, skip, todo } = require('../..');

/** @type {import('../..').RunTest} */
Expand Down
13 changes: 12 additions & 1 deletion lib/toTestResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ function getPerfStats({ stats }: Options): TestResult['perfStats'] {
const runtime = end - start;
// Note: this flag is set in 'lib/createJestRunner.ts'
const slow = false;
return { start, end, runtime, slow };
return {
start,
end,
runtime,
slow,
loadTestEnvironmentStart: 0,
loadTestEnvironmentEnd: 0,
setupAfterEnvStart: 0,
setupAfterEnvEnd: 0,
setupFilesStart: 0,
setupFilesEnd: 0,
};
}

function getSnapshot(): TestResult['snapshot'] {
Expand Down
43 changes: 23 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,40 @@
},
"dependencies": {
"chalk": "^4.1.0",
"jest-worker": "^29.5.0",
"jest-worker": "^30.0.0",
"p-limit": "^3.1.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-typescript": "^7.0.0",
"@jest/test-result": "^29.0.0",
"@eslint/compat": "^1.3.0",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.29.0",
"@jest/test-result": "^30.0.0",
"@tsconfig/node14": "^14.0.0",
"@types/node": "^14.18.23",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-jest": "^29.0.0",
"eslint": "^8.10.0",
"eslint-config-airbnb-base": "^15.0.0",
"@types/node": "^24.0.3",
"babel-jest": "^30.0.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^10.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-import-resolver-typescript": "^4.4.3",
"eslint-plugin-import-x": "^4.15.2",
"eslint-plugin-jest": "^29.0.0",
"eslint-plugin-prettier": "^5.0.0",
"execa": "^5.0.0",
"jest": "^29.0.0",
"jest-runner": "^29.0.0",
"prettier": "^2.0.5",
"globals": "^16.2.0",
"jest": "^30.0.0",
"jest-runner": "^30.0.0",
"prettier": "^3.5.3",
"semver": "^7.3.8",
"strip-ansi": "^6.0.0",
"typescript": "^5.0.0"
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0"
},
"peerDependencies": {
"@jest/test-result": "^28.0.0 || ^29.0.0",
"jest-runner": "^28.0.0 || ^29.0.0"
"@jest/test-result": "^28.0.0 || ^29.0.0 || ^30.0.0",
"jest-runner": "^28.0.0 || ^29.0.0 || ^30.0.0"
},
"peerDependenciesMeta": {
"@jest/test-result": {
Expand All @@ -86,10 +89,10 @@
"trailingComma": "all"
},
"resolutions": {
"@types/node@*": "^14.18.23"
"@types/node@*": "^18.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"packageManager": "yarn@3.8.7"
"packageManager": "yarn@4.9.2"
}
Loading
Loading