Skip to content

chore: migrate integration-tests from jest to vitest #10778

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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8725a18
Install `vitest`
aryaemami59 Feb 4, 2025
010f39e
Rename `jest.config.js` to `vitest.config.mts`
aryaemami59 Feb 4, 2025
7386ded
chore(integration-tests): migrate to `vitest`
aryaemami59 Feb 4, 2025
c4e8bbb
chore: validate root TS (#10912)
kirkwaiblinger Mar 5, 2025
487c80d
fix(eslint-plugin): [prefer-nullish-coalescing] treat `any`/`unknown`…
kirkwaiblinger Mar 6, 2025
8bca77c
chore: update sponsors (#10923)
typescript-eslint[bot] Mar 7, 2025
26cde72
Update `vitest` to version 3.0.8
aryaemami59 Mar 7, 2025
3cb652d
Remove `vitest/no-done-callback` as it is deprecated.
aryaemami59 Mar 7, 2025
530039c
Fix Vitest config
aryaemami59 Mar 7, 2025
d470828
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 7, 2025
487271f
Include `vitest.config.mts` in `tsconfig.spec.json`
aryaemami59 Mar 8, 2025
39e3eb6
Add `vitest.config.mts` files to ESLint configuration
aryaemami59 Mar 8, 2025
5529d48
Use `defineProject` instead of `defineConfig`
aryaemami59 Mar 10, 2025
c821137
Simplify `workspace` and `coverage.exclude`
aryaemami59 Mar 10, 2025
6eea50b
Explicitly enable `resolveJsonModule`
aryaemami59 Mar 10, 2025
6f44100
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 10, 2025
47971cd
Use `.replace` instead of `.split`
aryaemami59 Mar 10, 2025
4ac2aba
Type check `vitest.config.mts` files using project references.
aryaemami59 Mar 10, 2025
aeaab08
Fix `@nx/vite/plugin` usage in `nx.json`
aryaemami59 Mar 10, 2025
f543444
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 10, 2025
59f3be5
Update `@vitest/eslint-plugin` to version 1.1.37
aryaemami59 Mar 11, 2025
d56610e
Fix Vitest config
aryaemami59 Mar 12, 2025
d4cd6f6
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 12, 2025
735f3b0
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 15, 2025
046ef20
Update `vite` to version 6.2.2
aryaemami59 Mar 15, 2025
94d08d0
Fix `typecheck` task
aryaemami59 Mar 16, 2025
9871b35
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 22, 2025
57d699b
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 26, 2025
936b603
Update `vitest` to version 3.0.9
aryaemami59 Mar 26, 2025
6067c14
Update `@vitest/eslint-plugin` to version 1.1.38
aryaemami59 Mar 26, 2025
3644c1c
Fix `integration-tests`
aryaemami59 Mar 27, 2025
67ca16a
Fix `integration-tests`
aryaemami59 Mar 27, 2025
b5cae28
Fix `knip`
aryaemami59 Mar 27, 2025
d73f172
Fix `knip`
aryaemami59 Mar 27, 2025
16429f3
Remove unnecessary `typings/global.d.ts` file
aryaemami59 Mar 27, 2025
bb33d08
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 27, 2025
5839e09
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 31, 2025
ec002c1
Update `vitest` to version 3.1.1
aryaemami59 Mar 31, 2025
dc90e87
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 31, 2025
5202a7e
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 2, 2025
b23c42d
Update `@vitest/eslint-plugin` to version 1.1.39
aryaemami59 Apr 2, 2025
4a09a2d
Fix `knip` config
aryaemami59 Apr 3, 2025
c2411a7
Update `vite` to version 6.2.5
aryaemami59 Apr 3, 2025
308e3ba
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 5, 2025
977ca54
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 7, 2025
9da04c0
Fix `integration-tests`
aryaemami59 Apr 7, 2025
4d4b731
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 7, 2025
59482bc
Fix `integration-tests`
aryaemami59 Apr 8, 2025
09958c9
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
b802e16
Update `vite` to version 6.2.6
aryaemami59 Apr 10, 2025
e000051
Update `@vitest/eslint-plugin` to version 1.1.40
aryaemami59 Apr 10, 2025
03b251f
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
5ea2722
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
03a9ddc
Update `@vitest/eslint-plugin` to version 1.1.42
aryaemami59 Apr 11, 2025
1ad683c
Enable the new `vitest/prefer-describe-function-title` rule
aryaemami59 Apr 11, 2025
c381351
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
85871ec
Use `vitestPlugin.configs.env`
aryaemami59 Apr 11, 2025
1472976
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
6ccbe2a
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
9e8eeb4
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
578d215
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
24ab0be
Run `ast-spec:typecheck` during `postinstall`
aryaemami59 Apr 11, 2025
3aada33
Fix `ast-spec:test`
aryaemami59 Apr 11, 2025
67e80df
Try disabling remote cache
aryaemami59 Apr 12, 2025
bb7e02e
Try disabling remote cache
aryaemami59 Apr 12, 2025
3f8d5fb
Update `typecheck` output path in `nx.json`
aryaemami59 Apr 12, 2025
e62aa0a
Fix `vitest` coverage output when run with `nx`
aryaemami59 Apr 12, 2025
b770af7
Merge branch 'main'
JoshuaKGoldberg Apr 14, 2025
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
11 changes: 6 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ const restrictNamedDeclarations = {

const vitestFiles = [
'packages/eslint-plugin-internal/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/typescript-eslint/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/visitor-keys/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/integration-tests/tests/**/*.test.{ts,tsx,cts,mts},',
'packages/integration-tests/tools/integration-test-base.ts',
'packages/integration-tests/tools/pack-packages.ts',
'packages/parser/tests/lib/**/*.test.{ts,tsx,cts,mts}',
'packages/parser/tests/test-utils/**/*.{ts,tsx,cts,mts}',
'packages/utils/tests/**/*.test?(-d).{ts,tsx,cts,mts}',
'packages/type-utils/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/typescript-eslint/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/utils/tests/**/*.test?(-d).{ts,tsx,cts,mts}',
'packages/visitor-keys/tests/**/*.test.{ts,tsx,cts,mts}',
];

export default tseslint.config(
Expand Down Expand Up @@ -390,8 +393,6 @@ export default tseslint.config(
files: [
'packages/*/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/*/tests/**/test.{ts,tsx,cts,mts}',
'packages/integration-tests/tools/integration-test-base.ts',
'packages/integration-tests/tools/pack-packages.ts',
],
ignores: vitestFiles,
rules: {
Expand Down
2 changes: 1 addition & 1 deletion knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
ignore: ['tests/fixtures/**'],
},
'packages/integration-tests': {
ignore: ['fixtures/**', 'typings/global.d.ts'],
ignore: ['fixtures/**'],
},
'packages/parser': {
ignore: ['tests/fixtures/**'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { FlatCompat } from '@eslint/eslintrc';
import eslint from '@eslint/js';
import stylisticPlugin from '@stylistic/eslint-plugin';
import vitestPlugin from '@vitest/eslint-plugin';
import deprecationPlugin from 'eslint-plugin-deprecation';
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';

import __dirname from './dirname.cjs';
Expand All @@ -26,7 +26,7 @@ export default tseslint.config(
plugins: {
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
},
eslint.configs.recommended,
Expand All @@ -42,23 +42,23 @@ function _otherCases() {
['@stylistic']: stylisticPlugin,
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
});
tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
stylisticPlugin.configs['recommended-flat'],
jestPlugin.configs['flat/recommended'],
vitestPlugin.configs.recommended,
);
tseslint.config(
// @ts-expect-error
compat.config(deprecationPlugin.configs.recommended),
...compat.config(jestPlugin.configs.recommended),
vitestPlugin.configs.recommended,
);
tseslint.config(
// @ts-expect-error
deprecationPlugin.configs.recommended,
jestPlugin.configs.recommended,
vitestPlugin.configs.recommended,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"eslint": "9.9.1",
"@stylistic/eslint-plugin": "2.3.0",
"eslint-plugin-deprecation": "latest",
"eslint-plugin-jest": "latest"
"@vitest/eslint-plugin": "latest"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { FlatCompat } from '@eslint/eslintrc';
import eslint from '@eslint/js';
import stylisticPlugin from '@stylistic/eslint-plugin';
import vitestPlugin from '@vitest/eslint-plugin';
import deprecationPlugin from 'eslint-plugin-deprecation';
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';

import __dirname from './dirname.cjs';
Expand All @@ -26,7 +26,7 @@ export default tseslint.config(
plugins: {
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
},
eslint.configs.recommended,
Expand All @@ -42,23 +42,23 @@ function _otherCases() {
['@stylistic']: stylisticPlugin,
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
});
tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
stylisticPlugin.configs['recommended-flat'],
jestPlugin.configs['flat/recommended'],
vitestPlugin.configs.recommended,
);
tseslint.config(
// @ts-expect-error
compat.config(deprecationPlugin.configs.recommended),
...compat.config(jestPlugin.configs.recommended),
vitestPlugin.configs.recommended,
);
tseslint.config(
// @ts-expect-error
deprecationPlugin.configs.recommended,
jestPlugin.configs.recommended,
vitestPlugin.configs.recommended,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"eslint": "latest",
"@stylistic/eslint-plugin": "latest",
"eslint-plugin-deprecation": "latest",
"eslint-plugin-jest": "latest"
"@vitest/eslint-plugin": "latest"
}
}
17 changes: 0 additions & 17 deletions packages/integration-tests/jest.config.js

This file was deleted.

7 changes: 3 additions & 4 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"scripts": {
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"lint": "npx nx lint",
"test": "jest --no-coverage",
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
"check-types": "npx nx typecheck"
},
"devDependencies": {
"@jest/types": "29.6.3",
"jest": "29.7.0",
"tsx": "*"
"@vitest/coverage-v8": "^3.1.1",
"vitest": "^3.1.1"
}
}
7 changes: 6 additions & 1 deletion packages/integration-tests/project.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"name": "integration-tests",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"projectType": "library",
"root": "packages/integration-tests",
"sourceRoot": "packages/integration-tests/tools",
"implicitDependencies": ["typescript-eslint"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/vite:test"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`eslint-v8 eslint should work successfully 1`] = `
exports[`eslint-v8 > eslint > should work successfully 1`] = `
[
{
"errorCount": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`flat-config-types-@types__eslint-v8 eslint should work successfully 1`] = `
exports[`flat-config-types-@types__eslint-v8 > eslint > should work successfully 1`] = `
[
{
"errorCount": 3,
Expand Down Expand Up @@ -48,8 +48,8 @@ exports[`flat-config-types-@types__eslint-v8 eslint should work successfully 1`]
import { FlatCompat } from '@eslint/eslintrc'
import eslint from '@eslint/js'
import stylisticPlugin from '@stylistic/eslint-plugin'
import vitestPlugin from '@vitest/eslint-plugin'
import deprecationPlugin from 'eslint-plugin-deprecation'
import jestPlugin from 'eslint-plugin-jest'
import tseslint from 'typescript-eslint'

import __dirname from './dirname.cjs'
Expand All @@ -71,7 +71,7 @@ export default tseslint.config(
plugins: {
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
},
eslint.configs.recommended,
Expand All @@ -87,24 +87,24 @@ function _otherCases() {
['@stylistic']: stylisticPlugin,
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
})
tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
stylisticPlugin.configs['recommended-flat'],
jestPlugin.configs['flat/recommended'],
vitestPlugin.configs.recommended,
)
tseslint.config(
// @ts-expect-error
compat.config(deprecationPlugin.configs.recommended),
...compat.config(jestPlugin.configs.recommended),
vitestPlugin.configs.recommended,
)
tseslint.config(
// @ts-expect-error
deprecationPlugin.configs.recommended,
jestPlugin.configs.recommended,
vitestPlugin.configs.recommended,
)
}
",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`flat-config-types-@types__eslint-v9 eslint should work successfully 1`] = `
exports[`flat-config-types-@types__eslint-v9 > eslint > should work successfully 1`] = `
[
{
"errorCount": 3,
Expand Down Expand Up @@ -48,8 +48,8 @@ exports[`flat-config-types-@types__eslint-v9 eslint should work successfully 1`]
import { FlatCompat } from '@eslint/eslintrc'
import eslint from '@eslint/js'
import stylisticPlugin from '@stylistic/eslint-plugin'
import vitestPlugin from '@vitest/eslint-plugin'
import deprecationPlugin from 'eslint-plugin-deprecation'
import jestPlugin from 'eslint-plugin-jest'
import tseslint from 'typescript-eslint'

import __dirname from './dirname.cjs'
Expand All @@ -71,7 +71,7 @@ export default tseslint.config(
plugins: {
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
},
eslint.configs.recommended,
Expand All @@ -87,24 +87,24 @@ function _otherCases() {
['@stylistic']: stylisticPlugin,
['@typescript-eslint']: tseslint.plugin,
['deprecation']: deprecationPlugin,
['jest']: jestPlugin,
['vitest']: vitestPlugin,
},
})
tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
stylisticPlugin.configs['recommended-flat'],
jestPlugin.configs['flat/recommended'],
vitestPlugin.configs.recommended,
)
tseslint.config(
// @ts-expect-error
compat.config(deprecationPlugin.configs.recommended),
...compat.config(jestPlugin.configs.recommended),
vitestPlugin.configs.recommended,
)
tseslint.config(
// @ts-expect-error
deprecationPlugin.configs.recommended,
jestPlugin.configs.recommended,
vitestPlugin.configs.recommended,
)
}
",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`markdown eslint should work successfully 1`] = `
exports[`markdown > eslint > should work successfully 1`] = `
[
{
"errorCount": 10,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`recommended-does-not-require-program eslint should work successfully 1`] = `
exports[`recommended-does-not-require-program > eslint > should work successfully 1`] = `
[
{
"errorCount": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`vue-jsx eslint should work successfully 1`] = `
exports[`vue-jsx > eslint > should work successfully 1`] = `
[
{
"errorCount": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`vue-sfc eslint should work successfully 1`] = `
exports[`vue-sfc > eslint > should work successfully 1`] = `
[
{
"errorCount": 1,
Expand Down
6 changes: 3 additions & 3 deletions packages/integration-tests/tools/integration-test-base.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as fs from 'node:fs/promises';
import * as path from 'node:path';

import { execFile, FIXTURES_DESTINATION_DIR } from './pack-packages';
import { execFile, FIXTURES_DESTINATION_DIR } from './pack-packages.js';

// make sure that jest doesn't timeout the test
jest.setTimeout(60_000);
// make sure that vitest doesn't timeout the test
vi.setConfig({ testTimeout: 60_000 });
Comment on lines +6 to +7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just move this into vitest.config.mts file.


function integrationTest(
testName: string,
Expand Down
Loading
Loading