Skip to content

Commit 31bc474

Browse files
aryaemami59JoshuaKGoldberg
authored andcommitted
chore(types): migrate from jest to vitest (typescript-eslint#10776)
* Install `vitest` * Rename `jest.config.js` to `vitest.config.mts` * chore(types): migrate to `vitest` * Fix Vitest config * Include `vitest.config.mts` in `tsconfig.spec.json` * Explicitly enable `resolveJsonModule` * Use `.replace` instead of `.split` * Type check `vitest.config.mts` files using project references. * Fix Vitest config * Update `vitest` to version 3.1.1 * Update `@vitest/eslint-plugin` to version 1.1.39 * Fix `knip` * Update `vite` to version 6.2.5 * Update `vite` to version 6.2.6 * Update `@vitest/eslint-plugin` to version 1.1.40 * Update `@vitest/eslint-plugin` to version 1.1.42 * Enable the new `vitest/prefer-describe-function-title` rule * Use `vitestPlugin.configs.env` * Try disabling remote cache * Try disabling remote cache * Try disabling remote cache * Run `ast-spec:typecheck` during `postinstall` script * Update `typecheck` output path in `nx.json` * Fix `vitest` coverage output when run with `nx` --------- Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
1 parent d76da14 commit 31bc474

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const vitestFiles = [
4444
'packages/scope-manager/tests/**/*.test.{ts,tsx,cts,mts}',
4545
'packages/scope-manager/tests/test-utils/serializers/index.ts',
4646
'packages/type-utils/tests/**/*.test.{ts,tsx,cts,mts}',
47+
'packages/types/tests/**/*.test.{ts,tsx,cts,mts}',
4748
'packages/typescript-eslint/tests/**/*.test.{ts,tsx,cts,mts}',
4849
'packages/typescript-estree/tests/**/*.test.{ts,tsx,cts,mts}',
4950
'packages/utils/tests/**/*.test?(-d).{ts,tsx,cts,mts}',

packages/types/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
4545
"generate-lib": "npx nx run scope-manager:generate-lib",
4646
"lint": "npx nx lint",
47+
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
4748
"check-types": "npx nx typecheck"
4849
},
4950
"nx": {
@@ -66,10 +67,12 @@
6667
}
6768
},
6869
"devDependencies": {
70+
"@vitest/coverage-v8": "^3.1.1",
6971
"prettier": "^3.2.5",
7072
"rimraf": "*",
7173
"tsx": "*",
72-
"typescript": "*"
74+
"typescript": "*",
75+
"vitest": "^3.1.1"
7376
},
7477
"funding": {
7578
"type": "opencollective",

packages/types/project.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "types",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"type": "library",
4+
"projectType": "library",
5+
"root": "packages/types",
6+
"sourceRoot": "packages/types/src",
57
"implicitDependencies": ["ast-spec"],
68
"targets": {
79
"lint": {

packages/types/vitest.config.mts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig, mergeConfig } from 'vitest/config';
2+
3+
import { vitestBaseConfig } from '../../vitest.config.base.mjs';
4+
import packageJson from './package.json' with { type: 'json' };
5+
6+
const vitestConfig = mergeConfig(
7+
vitestBaseConfig,
8+
9+
defineConfig({
10+
root: import.meta.dirname,
11+
12+
test: {
13+
name: packageJson.name.replace('@typescript-eslint/', ''),
14+
root: import.meta.dirname,
15+
passWithNoTests: true,
16+
},
17+
}),
18+
);
19+
20+
export default vitestConfig;

yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6131,10 +6131,12 @@ __metadata:
61316131
version: 0.0.0-use.local
61326132
resolution: "@typescript-eslint/types@workspace:packages/types"
61336133
dependencies:
6134+
"@vitest/coverage-v8": ^3.1.1
61346135
prettier: ^3.2.5
61356136
rimraf: "*"
61366137
tsx: "*"
61376138
typescript: "*"
6139+
vitest: ^3.1.1
61386140
languageName: unknown
61396141
linkType: soft
61406142

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy