Skip to content

chore(scope-manager): migrate from jest to vitest #10677

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
47 commits
Select commit Hold shift + click to select a range
d5cd6ab
Install `vitest`
aryaemami59 Jan 18, 2025
da8743f
Rename `jest.config.js` to `vitest.config.mts`
aryaemami59 Jan 18, 2025
c81f4a6
chore(scope-manager): migrate to `vitest`
aryaemami59 Jan 18, 2025
9075172
Update `vitest` to version 3.0.8
aryaemami59 Mar 7, 2025
0774859
Fix Vitest config
aryaemami59 Mar 7, 2025
acb87d8
Include `vitest.config.mts` in `tsconfig.spec.json`
aryaemami59 Mar 8, 2025
ee81176
Add `vitest.config.mts` files to ESLint configuration
aryaemami59 Mar 8, 2025
2e6ca49
Use `defineProject` instead of `defineConfig`
aryaemami59 Mar 10, 2025
6b7c18f
Explicitly enable `resolveJsonModule`
aryaemami59 Mar 10, 2025
c53aea8
Use `.replace` instead of `.split`
aryaemami59 Mar 10, 2025
01d31d1
Type check `vitest.config.mts` files using project references.
aryaemami59 Mar 10, 2025
38bbad5
Fix Vitest config
aryaemami59 Mar 12, 2025
59cf7c5
Fix `typecheck` task
aryaemami59 Mar 16, 2025
c620ae5
Update `vitest` to version 3.0.9
aryaemami59 Mar 26, 2025
4a2f091
Update `@vitest/eslint-plugin` to version 1.1.38
aryaemami59 Mar 26, 2025
cb58d7b
Update `vitest` to version 3.1.1
aryaemami59 Mar 31, 2025
2bd4d35
Update `@vitest/eslint-plugin` to version 1.1.39
aryaemami59 Apr 2, 2025
4470e91
Fix `knip` config
aryaemami59 Apr 3, 2025
6d0b6bb
Update `vite` to version 6.2.5
aryaemami59 Apr 3, 2025
467d464
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 7, 2025
dad38a7
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
b710354
Update `vite` to version 6.2.6
aryaemami59 Apr 10, 2025
0b3bb37
Update `@vitest/eslint-plugin` to version 1.1.40
aryaemami59 Apr 10, 2025
9d92962
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 10, 2025
7049c20
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
51aa1fc
Update `@vitest/eslint-plugin` to version 1.1.42
aryaemami59 Apr 11, 2025
a5f46a0
Enable the new `vitest/prefer-describe-function-title` rule
aryaemami59 Apr 11, 2025
1f6327b
Fix `scope-manager` tests
aryaemami59 Apr 11, 2025
b7e8ca5
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
7acc9f0
Use `vitestPlugin.configs.env`
aryaemami59 Apr 11, 2025
5c8c5e5
Include test `setupFiles` in ESLint config
aryaemami59 Apr 11, 2025
aad0109
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
f33bf72
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
f382f9c
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
2128e85
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59 Apr 11, 2025
fe0b2c3
Run `ast-spec:typecheck` during `postinstall`
aryaemami59 Apr 11, 2025
3e9c2e1
Fix `ast-spec:test`
aryaemami59 Apr 11, 2025
3bc0e8f
Fix `ast-spec:build`
aryaemami59 Apr 11, 2025
0c6d484
Try disabling remote cache
aryaemami59 Apr 12, 2025
1b2e0ac
Try disabling remote cache
aryaemami59 Apr 12, 2025
b460a94
Update `typecheck` output path in `nx.json`
aryaemami59 Apr 12, 2025
cfd2235
Fix `vitest` coverage output when run with `nx`
aryaemami59 Apr 12, 2025
7b2aa04
Fix `scope-manager` tests
aryaemami59 Apr 12, 2025
edc1b9d
Merge branch 'main'
JoshuaKGoldberg Apr 14, 2025
9a26ce3
remove downlevel-dts line
JoshuaKGoldberg Apr 14, 2025
b1aad69
remove postbuild in scope-manager package.json
JoshuaKGoldberg Apr 14, 2025
45e2a9e
Merge branch 'main'
JoshuaKGoldberg Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const vitestFiles = [
'packages/parser/tests/lib/**/*.test.{ts,tsx,cts,mts}',
'packages/parser/tests/test-utils/**/*.{ts,tsx,cts,mts}',
'packages/rule-tester/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/scope-manager/tests/**/*.test.{ts,tsx,cts,mts}',
'packages/scope-manager/tests/test-utils/serializers/index.ts',
'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}',
Expand Down
14 changes: 13 additions & 1 deletion knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export default {
workspaces: {
'.': {
entry: ['tools/release/changelog-renderer.js', 'tools/scripts/**/*.mts'],
ignore: ['tools/scripts/typings/typescript.d.ts', 'typings/*.d.ts'],
ignore: [
'jest.config.base.js',
'tools/scripts/typings/typescript.d.ts',
'typings/*.d.ts',
],
ignoreDependencies: [
'@babel/code-frame',
'@babel/core',
Expand Down Expand Up @@ -78,6 +82,14 @@ export default {
},
'packages/scope-manager': {
ignore: ['tests/fixtures/**'],

vitest: {
config: ['vitest.config.mts'],
entry: [
'tests/**/*.{bench,test,test-d}.?(c|m)ts?(x)',
'tests/test-utils/serializers/index.ts',
],
},
},
'packages/type-utils': {
ignore: ['tests/fixtures/**', 'typings/typescript.d.ts'],
Expand Down
14 changes: 0 additions & 14 deletions packages/scope-manager/jest.config.js

This file was deleted.

16 changes: 7 additions & 9 deletions packages/scope-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,27 @@
"estree"
],
"scripts": {
"build": "npx nx build",
"clean": "npx nx clean",
"clean-fixtures": "npx nx clean-fixtures",
"build": "tsc -b tsconfig.build.json",
"clean": "rimraf dist/ _ts4.3/ coverage/",
"clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"generate-lib": "npx nx generate-lib repo",
"lint": "npx nx lint",
"test": "jest",
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
"check-types": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "8.29.1",
"@typescript-eslint/visitor-keys": "8.29.1"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/typescript-estree": "8.29.1",
"@vitest/coverage-v8": "^3.1.1",
"glob": "*",
"jest": "29.7.0",
"jest-specific-snapshot": "*",
"make-dir": "*",
"prettier": "^3.2.5",
"pretty-format": "*",
"typescript": "*"
"typescript": "*",
"vitest": "^3.1.1"
},
"funding": {
"type": "opencollective",
Expand Down
36 changes: 2 additions & 34 deletions packages/scope-manager/project.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,16 @@
{
"name": "scope-manager",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "packages/scope-manager",
"sourceRoot": "packages/scope-manager/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{projectRoot}/dist"],
"options": {
"parallel": false,
"cwd": "packages/scope-manager",
"commands": ["tsc -b tsconfig.build.json"]
}
},
"clean": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"cwd": "packages/scope-manager",
"commands": [
"tsc -b tsconfig.build.json --clean",
"rimraf dist",
"rimraf coverage"
]
}
},
"clean-fixtures": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"cwd": "packages/scope-manager",
"commands": ["rimraf -g \"./src/**/fixtures/**/snapshots\""]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "packages/scope-manager/jest.config.js"
}
"executor": "@nx/vite:test"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Class fields', () => {
expect(classFieldInitializerScope.variables).toHaveLength(0);
});

describe('class C { f }', () => {
it('class C { f }', () => {
const { scopeManager } = parseAndAnalyze('class C { f }');

const globalScope = scopeManager.scopes[0];
Expand All @@ -57,7 +57,7 @@ describe('Class fields', () => {
expect(classScope.variables[0].name).toBe('C');
});

describe('class C { [fname] }', () => {
it('class C { [fname] }', () => {
const { scopeManager } = parseAndAnalyze('class C { [fname] }');

const globalScope = scopeManager.scopes[0];
Expand All @@ -72,7 +72,7 @@ describe('Class fields', () => {
expect(classScope.childScopes).toHaveLength(0);
});

describe('class C { [fname] = value }', () => {
it('class C { [fname] = value }', () => {
const { scopeManager } = parseAndAnalyze('class C { [fname] = value }');

const globalScope = scopeManager.scopes[0];
Expand Down
Loading