Skip to content

Commit 7f32763

Browse files
chore: migrate rule-schema-to-typescript-types from jest to vitest (#10774)
* Install `vitest` * Rename `jest.config.js` to `vitest.config.mts` * chore(rule-schema-to-typescript-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 * Update `typecheck` output path in `nx.json` * Fix `vitest` coverage output when run with `nx` --------- Co-authored-by: Josh Goldberg <[email protected]>
1 parent be558e5 commit 7f32763

File tree

7 files changed

+34
-4
lines changed

7 files changed

+34
-4
lines changed

Diff for: eslint.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const vitestFiles = [
3939
'packages/integration-tests/tools/pack-packages.ts',
4040
'packages/parser/tests/lib/**/*.test.{ts,tsx,cts,mts}',
4141
'packages/parser/tests/test-utils/**/*.{ts,tsx,cts,mts}',
42+
'packages/rule-schema-to-typescript-types/tests/**/*.test.{ts,tsx,cts,mts}',
4243
'packages/rule-tester/tests/**/*.test.{ts,tsx,cts,mts}',
4344
'packages/scope-manager/tests/**/*.test.{ts,tsx,cts,mts}',
4445
'packages/scope-manager/tests/test-utils/serializers/index.ts',
@@ -88,6 +89,7 @@ export default tseslint.config(
8889
'.nx/',
8990
'.yarn/',
9091
'**/jest.config.js',
92+
'**/vitest.config.mts',
9193
'**/node_modules/**',
9294
'**/dist/**',
9395
'**/fixtures/**',

Diff for: packages/rule-schema-to-typescript-types/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"build": "tsc -b tsconfig.build.json",
2828
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
2929
"lint": "npx nx lint",
30+
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
3031
"check-types": "npx nx typecheck"
3132
},
3233
"dependencies": {
@@ -36,7 +37,9 @@
3637
"prettier": "^3.2.5"
3738
},
3839
"devDependencies": {
39-
"typescript": "*"
40+
"@vitest/coverage-v8": "^3.1.1",
41+
"typescript": "*",
42+
"vitest": "^3.1.1"
4043
},
4144
"funding": {
4245
"type": "opencollective",

Diff for: packages/rule-schema-to-typescript-types/project.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "rule-schema-to-typescript-types",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"type": "library",
5-
"implicitDependencies": [],
4+
"projectType": "library",
5+
"root": "packages/rule-schema-to-typescript-types",
6+
"sourceRoot": "packages/rule-schema-to-typescript-types/src",
67
"targets": {
78
"lint": {
89
"executor": "@nx/eslint:lint",

Diff for: packages/rule-schema-to-typescript-types/tsconfig.build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"resolveJsonModule": true
1111
},
1212
"include": ["src/**/*.ts", "typings"],
13-
"exclude": ["jest.config.js", "src/**/*.spec.ts", "src/**/*.test.ts"],
13+
"exclude": ["vitest.config.mts", "src/**/*.spec.ts", "src/**/*.test.ts"],
1414
"references": [
1515
{
1616
"path": "../utils/tsconfig.build.json"
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;

Diff for: tsconfig.repo-config-files.json

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"tools/**/*.ts",
1313
"tools/**/*.mts",
1414
"eslint.config.mjs",
15+
"vitest.config.base.mts",
16+
"vitest.config.mts",
1517
"jest.config.base.js",
1618
"jest.config.js",
1719
"jest.preset.js",

Diff for: yarn.lock

+2
Original file line numberDiff line numberDiff line change
@@ -6054,9 +6054,11 @@ __metadata:
60546054
dependencies:
60556055
"@typescript-eslint/type-utils": 8.30.1
60566056
"@typescript-eslint/utils": 8.30.1
6057+
"@vitest/coverage-v8": ^3.1.1
60576058
natural-compare: ^1.4.0
60586059
prettier: ^3.2.5
60596060
typescript: "*"
6061+
vitest: ^3.1.1
60606062
languageName: unknown
60616063
linkType: soft
60626064

0 commit comments

Comments
 (0)