Skip to content

Commit 418375c

Browse files
authored
test: migrate from jest to vitest eslint plugin, remove remaining jest references (#14997)
- Removes old references to jest or files/dependencies that were no longer used - Removes the jest eslint plugin - Installs the vitest eslint plugin. Didn't see any issues with the recommended config, scrolling through our test files
1 parent 7a4d37a commit 418375c

15 files changed

Lines changed: 54 additions & 1823 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
## Build Files
2424

25-
**/jest.config.js @denolfe @AlessioGr
25+
**/vitest.config.ts @denolfe @AlessioGr
2626
**/tsconfig*.json @denolfe @AlessioGr
2727

2828
## Root

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
"script:pack": "pnpm --filter scripts pack-all-to-dest",
124124
"pretest": "pnpm build",
125125
"test": "pnpm test:int && pnpm test:components && pnpm test:e2e",
126-
"test:components": "cross-env NODE_OPTIONS=\" --no-deprecation --no-experimental-strip-types\" jest --config=jest.components.config.js",
127126
"test:e2e": "pnpm runts ./test/runE2E.ts",
128127
"test:e2e:debug": "cross-env NODE_OPTIONS=\"--no-deprecation --no-experimental-strip-types\" NODE_NO_WARNINGS=1 PWDEBUG=1 DISABLE_LOGGING=true playwright test",
129128
"test:e2e:headed": "cross-env NODE_OPTIONS=\"--no-deprecation --no-experimental-strip-types\" NODE_NO_WARNINGS=1 DISABLE_LOGGING=true playwright test --headed",
@@ -164,7 +163,6 @@
164163
"@swc-node/register": "1.11.1",
165164
"@swc/cli": "0.7.9",
166165
"@swc/core": "1.15.3",
167-
"@swc/jest": "0.2.39",
168166
"@types/fs-extra": "^11.0.2",
169167
"@types/minimist": "1.2.5",
170168
"@types/node": "22.15.30",

packages/eslint-config/configs/jest/index.mjs

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

packages/eslint-config/configs/jest/rules/jest-dom.mjs

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

packages/eslint-config/configs/jest/rules/jest.mjs

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

packages/eslint-config/index.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { configs as regexpPluginConfigs } from 'eslint-plugin-regexp'
55
import eslintConfigPrettier from 'eslint-config-prettier/flat'
66
import payloadPlugin from '@payloadcms/eslint-plugin'
77
import reactExtends from './configs/react/index.mjs'
8-
import jestExtends from './configs/jest/index.mjs'
98
import globals from 'globals'
109
import importX from 'eslint-plugin-import-x'
1110
import typescriptParser from '@typescript-eslint/parser'
1211
import { deepMerge } from './deepMerge.js'
1312
import reactCompiler from 'eslint-plugin-react-compiler'
13+
import vitest from '@vitest/eslint-plugin'
1414

1515
const baseRules = {
1616
// This rule makes no sense when overriding class methods. This is used a lot in richtext-lexical.
@@ -233,17 +233,16 @@ export const rootEslintConfig = [
233233
},
234234
{
235235
name: 'Unit Tests',
236-
...deepMerge(jestExtends, {
237-
plugins: {
238-
payload: payloadPlugin,
239-
},
240-
rules: {
241-
...baseRules,
242-
...typescriptRules,
243-
'@typescript-eslint/unbound-method': 'off',
244-
},
245-
}),
246-
files: ['**/*.spec.ts'],
236+
plugins: {
237+
vitest
238+
},
239+
rules: {
240+
...vitest.configs.recommended.rules,
241+
},
242+
files: [
243+
'**/*.spec.ts',
244+
'!**/*.e2e.spec.ts',
245+
],
247246
},
248247
{
249248
name: 'Payload Config',

packages/eslint-config/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
"@payloadcms/eslint-plugin": "workspace:*",
3030
"@types/eslint": "9.6.1",
3131
"@typescript-eslint/parser": "8.26.1",
32+
"@vitest/eslint-plugin": "1.5.4",
3233
"eslint": "9.22.0",
3334
"eslint-config-prettier": "10.1.1",
3435
"eslint-plugin-import-x": "4.6.1",
35-
"eslint-plugin-jest": "28.11.0",
36-
"eslint-plugin-jest-dom": "5.5.0",
3736
"eslint-plugin-jsx-a11y": "6.10.2",
3837
"eslint-plugin-perfectionist": "3.9.1",
3938
"eslint-plugin-react-compiler": "19.1.0-rc.2",

packages/eslint-plugin/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
"@eslint/js": "9.22.0",
2929
"@types/eslint": "9.6.1",
3030
"@typescript-eslint/parser": "8.26.1",
31+
"@vitest/eslint-plugin": "1.5.4",
3132
"eslint": "9.22.0",
3233
"eslint-config-prettier": "10.1.1",
3334
"eslint-plugin-import-x": "4.6.1",
34-
"eslint-plugin-jest": "28.11.0",
35-
"eslint-plugin-jest-dom": "5.5.0",
3635
"eslint-plugin-jsx-a11y": "6.10.2",
3736
"eslint-plugin-perfectionist": "3.9.1",
3837
"eslint-plugin-react-hooks": "0.0.0-experimental-d331ba04-20250307",

packages/graphql/src/utilities/formatName.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/prefer-strict-equal */
21
import { describe, it, expect } from 'vitest'
32
import { formatName } from './formatName'
43

0 commit comments

Comments
 (0)