Skip to content

chore(typescript-estree): migrate from jest to vitest #10679

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
63 commits
Select commit Hold shift + click to select a range
7fb78fe
Install `vitest`
aryaemami59 Jan 18, 2025
938003b
Rename `jest.config.js` to `vitest.config.mts`
aryaemami59 Jan 18, 2025
2df19e9
chore(typescript-estree): migrate to `vitest`
aryaemami59 Jan 18, 2025
f8cf6f1
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 7, 2025
a2b1e51
Update `vitest` to version 3.0.8
aryaemami59 Mar 7, 2025
6e6d719
Remove `vitest/no-done-callback` as it is deprecated.
aryaemami59 Mar 7, 2025
3cde2af
Fix Vitest config
aryaemami59 Mar 7, 2025
8b43846
Include `vitest.config.mts` in `tsconfig.spec.json`
aryaemami59 Mar 8, 2025
1c78ddd
Add `vitest.config.mts` files to ESLint configuration
aryaemami59 Mar 8, 2025
24fafe4
Use `defineProject` instead of `defineConfig`
aryaemami59 Mar 10, 2025
bc086d5
Simplify `workspace` and `coverage.exclude`
aryaemami59 Mar 10, 2025
94f9469
Explicitly enable `resolveJsonModule`
aryaemami59 Mar 10, 2025
c21cd5e
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 10, 2025
b5772a4
Use `.replace` instead of `.split`
aryaemami59 Mar 10, 2025
32ada57
Type check `vitest.config.mts` files using project references.
aryaemami59 Mar 10, 2025
144c734
Fix `@nx/vite/plugin` usage in `nx.json`
aryaemami59 Mar 10, 2025
4c0d7a7
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 10, 2025
b1af553
Update `@vitest/eslint-plugin` to version 1.1.37
aryaemami59 Mar 11, 2025
ecf8f6f
Fix Vitest config
aryaemami59 Mar 12, 2025
29ed603
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 12, 2025
6cc56a9
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 15, 2025
ed54dda
Update `vite` to version 6.2.2
aryaemami59 Mar 15, 2025
0148ebb
Fix `typecheck` task
aryaemami59 Mar 16, 2025
58aa260
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 22, 2025
81664a7
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 26, 2025
32ae859
Update `vitest` to version 3.0.9
aryaemami59 Mar 26, 2025
9f080ed
Update `@vitest/eslint-plugin` to version 1.1.38
aryaemami59 Mar 26, 2025
efe8ebc
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 27, 2025
ba17bb9
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 31, 2025
eab480e
Update `vitest` to version 3.1.1
aryaemami59 Mar 31, 2025
54c8c9b
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Mar 31, 2025
538a36f
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 2, 2025
e7a0a2b
Update `@vitest/eslint-plugin` to version 1.1.39
aryaemami59 Apr 2, 2025
7396775
Fix `knip` config
aryaemami59 Apr 3, 2025
b839c59
Update `vite` to version 6.2.5
aryaemami59 Apr 3, 2025
f876198
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 5, 2025
d99b077
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 7, 2025
2448f19
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 7, 2025
e407fd9
Fix `typescript-estree` tests
aryaemami59 Apr 8, 2025
37264e5
Fix `typescript-estree` tests
aryaemami59 Apr 8, 2025
cdc6281
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
11b20d5
Update `vite` to version 6.2.6
aryaemami59 Apr 10, 2025
ccff7f0
Update `@vitest/eslint-plugin` to version 1.1.40
aryaemami59 Apr 10, 2025
5208acb
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
92d9f65
Fix `typescript-estree` tests
aryaemami59 Apr 10, 2025
d045e12
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
0b980d6
Update `@vitest/eslint-plugin` to version 1.1.42
aryaemami59 Apr 11, 2025
394f14c
Enable the new `vitest/prefer-describe-function-title` rule
aryaemami59 Apr 11, 2025
0417d11
Switch to `it.for`
aryaemami59 Apr 11, 2025
66e1b09
Use `vitestPlugin.configs.env`
aryaemami59 Apr 11, 2025
2f396f8
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
e27e98d
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
c6d427d
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
14bb0c5
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
dd87481
Run `ast-spec:typecheck` during `postinstall`
aryaemami59 Apr 11, 2025
4d9a6d0
Fix `ast-spec:test`
aryaemami59 Apr 11, 2025
73dff2f
Try disabling remote cache
aryaemami59 Apr 12, 2025
4d76774
Try disabling remote cache
aryaemami59 Apr 12, 2025
c51d10b
Remove `@types/tmp`
aryaemami59 Apr 12, 2025
2aeff8f
Update `typecheck` output path in `nx.json`
aryaemami59 Apr 12, 2025
8d3325a
Fix `vitest` coverage output when run with `nx`
aryaemami59 Apr 12, 2025
7dffbe0
Fix `typescript-estree` tests
aryaemami59 Apr 12, 2025
d043fbe
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
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const vitestFiles = [
'packages/rule-tester/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/type-utils/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/typescript-eslint/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/typescript-estree/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/utils/tests/**/*.test?(-d).{ts,tsx,cts,mts}',
'packages/visitor-keys/tests/**/*.test.{ts,tsx,cts,mts}',
];
Expand Down
5 changes: 5 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export default {
'packages/typescript-estree': {
entry: ['src/use-at-your-own-risk.ts'],
ignore: ['tests/fixtures/**', 'typings/typescript.d.ts'],

vitest: {
config: ['vitest.config.mts'],
entry: ['tests/lib/**/*.{bench,test,test-d}.?(c|m)ts?(x)'],
},
},
'packages/utils': {
ignore: [
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"@types/natural-compare": "^1.4.3",
"@types/node": "^20.12.5",
"@types/semver": "^7.5.8",
"@types/tmp": "^0.2.6",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "workspace:^",
"@typescript-eslint/eslint-plugin-internal": "workspace:^",
Expand Down
11 changes: 0 additions & 11 deletions packages/typescript-estree/jest.config.js

This file was deleted.

9 changes: 4 additions & 5 deletions packages/typescript-estree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"postclean": "rimraf dist/ coverage/",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"lint": "npx nx lint",
"test": "jest --runInBand --verbose",
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
"check-types": "npx nx typecheck"
},
"dependencies": {
Expand All @@ -63,13 +63,12 @@
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@vitest/coverage-v8": "^3.1.1",
"glob": "*",
"jest": "29.7.0",
"prettier": "^3.2.5",
"rimraf": "*",
"tmp": "*",
"typescript": "*"
"typescript": "*",
"vitest": "^3.1.1"
},
"peerDependencies": {
"typescript": ">=4.8.4 <5.9.0"
Expand Down
8 changes: 6 additions & 2 deletions packages/typescript-estree/project.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "typescript-estree",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"type": "library",
"implicitDependencies": ["types"],
"projectType": "library",
"root": "packages/typescript-estree",
"sourceRoot": "packages/typescript-estree/src",
"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[`convert deeplyCopy should convert array of nodes 1`] = `
exports[`convert > deeplyCopy > should convert array of nodes 1`] = `
{
"ambientModuleNames": undefined,
"amdDependencies": [],
Expand Down Expand Up @@ -200,7 +200,7 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = `
}
`;

exports[`convert deeplyCopy should convert node correctly 1`] = `
exports[`convert > deeplyCopy > should convert node correctly 1`] = `
{
"body": [
{
Expand Down Expand Up @@ -498,7 +498,7 @@ exports[`convert deeplyCopy should convert node correctly 1`] = `
}
`;

exports[`convert deeplyCopy should convert node with decorators correctly 1`] = `
exports[`convert > deeplyCopy > should convert node with decorators correctly 1`] = `
{
"decorators": [
{
Expand Down Expand Up @@ -584,7 +584,7 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] =
}
`;

exports[`convert deeplyCopy should convert node with type arguments correctly 1`] = `
exports[`convert > deeplyCopy > should convert node with type arguments correctly 1`] = `
{
"arguments": [],
"emitNode": undefined,
Expand Down Expand Up @@ -687,7 +687,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1`
}
`;

exports[`convert deeplyCopy should convert node with type parameters correctly 1`] = `
exports[`convert > deeplyCopy > should convert node with type parameters correctly 1`] = `
{
"emitNode": undefined,
"id": 0,
Expand Down

Large diffs are not rendered by default.

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[`parseAndGenerateServices isolated parsing should parse .js file - with JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .js file - with JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -297,7 +297,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .js file - with JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .js file - with JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -594,7 +594,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .js file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .js file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -781,7 +781,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .js file - without JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .js file - without JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -968,7 +968,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .json file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .json file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -1191,7 +1191,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .jsx file - with JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -1488,7 +1488,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .jsx file - with JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -1785,7 +1785,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .jsx file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .jsx file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -1972,7 +1972,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .jsx file - without JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .jsx file - without JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -2159,7 +2159,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .ts file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .ts file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -2346,7 +2346,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .ts file - without JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .ts file - without JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -2533,7 +2533,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .tsx file - with JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -2830,7 +2830,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .tsx file - with JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -3127,7 +3127,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .tsx file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .tsx file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -3314,7 +3314,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .tsx file - without JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .tsx file - without JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -3501,7 +3501,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .vue file - with JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .vue file - with JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -3798,7 +3798,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .vue file - without JSX content - parserOptions.jsx = false 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .vue file - without JSX content - parserOptions.jsx = false 1`] = `
{
"ast": {
"body": [
Expand Down Expand Up @@ -3985,7 +3985,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with
}
`;

exports[`parseAndGenerateServices isolated parsing should parse .vue file - without JSX content - parserOptions.jsx = true 1`] = `
exports[`parseAndGenerateServices > isolated parsing > should parse .vue file - without JSX content - parserOptions.jsx = true 1`] = `
{
"ast": {
"body": [
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[`semanticInfo fixtures/export-file.src 1`] = `
exports[`semanticInfo > fixtures/export-file.src 1`] = `
{
"body": [
{
Expand Down Expand Up @@ -300,7 +300,7 @@ exports[`semanticInfo fixtures/export-file.src 1`] = `
}
`;

exports[`semanticInfo fixtures/import-file.src 1`] = `
exports[`semanticInfo > fixtures/import-file.src 1`] = `
{
"body": [
{
Expand Down Expand Up @@ -789,7 +789,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = `
}
`;

exports[`semanticInfo fixtures/isolated-file.src 1`] = `
exports[`semanticInfo > fixtures/isolated-file.src 1`] = `
{
"body": [
{
Expand Down Expand Up @@ -1148,7 +1148,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = `
}
`;

exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = `
exports[`semanticInfo > fixtures/non-existent-estree-nodes.src 1`] = `
{
"body": [
{
Expand Down
Loading