Skip to content

chore(tsconfig-utils): sync vitest config with latest setup #11239

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
6 changes: 6 additions & 0 deletions packages/project-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
"@typescript-eslint/types": "^8.33.1",
"debug": "^4.3.4"
},
"devDependencies": {
"@vitest/coverage-v8": "^3.1.3",
"rimraf": "*",
"typescript": "*",
"vitest": "^3.1.3"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
Expand Down
6 changes: 6 additions & 0 deletions packages/tsconfig-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"peerDependencies": {
"typescript": ">=4.8.4 <5.9.0"
},
"devDependencies": {
"@vitest/coverage-v8": "^3.1.3",
"rimraf": "*",
"typescript": "*",
"vitest": "^3.1.3"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'node:path';
import * as path from 'node:path';
import * as ts from 'typescript';

import { getParsedConfigFile } from '../../src/getParsedConfigFile';
import { getParsedConfigFile } from '../src/getParsedConfigFile.js';

const mockGetParsedCommandLineOfConfigFile = vi.fn();

Expand All @@ -22,9 +22,9 @@ describe(getParsedConfigFile, () => {
});

it('throws an error when tsserver.sys is undefined', () => {
expect(() =>
getParsedConfigFile({} as typeof ts, './tsconfig.json'),
).toThrow(
expect(() => {
getParsedConfigFile({} as typeof ts, './tsconfig.json');
}).toThrow(
'`getParsedConfigFile` is only supported in a Node-like environment.',
);
});
Expand Down Expand Up @@ -72,9 +72,9 @@ describe(getParsedConfigFile, () => {
},
] satisfies ts.Diagnostic[],
});
expect(() => getParsedConfigFile(mockTsserver, './tsconfig.json')).toThrow(
/.+ error TS1234: Oh no!/,
);
expect(() => {
getParsedConfigFile(mockTsserver, './tsconfig.json');
}).toThrow(/.+ error TS1234: Oh no!/);
});

it('throws a diagnostic error when getParsedCommandLineOfConfigFile throws an error', () => {
Expand All @@ -96,9 +96,9 @@ describe(getParsedConfigFile, () => {
} satisfies ts.Diagnostic);
},
);
expect(() => getParsedConfigFile(mockTsserver, './tsconfig.json')).toThrow(
/.+ error TS1234: Oh no!/,
);
expect(() => {
getParsedConfigFile(mockTsserver, './tsconfig.json');
}).toThrow(/.+ error TS1234: Oh no!/);
});

it('uses compiler options when parsing a config file succeeds', () => {
Expand Down
13 changes: 2 additions & 11 deletions packages/tsconfig-utils/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
"emitDeclarationOnly": false,
"types": ["node"]
},
"include": ["src/**/*.ts", "typings"],
"exclude": ["vitest.config.mts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"extends": "../../tsconfig.build.json",
"compilerOptions": {},
"references": []
}
14 changes: 1 addition & 13 deletions packages/tsconfig-utils/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc/packages/tsconfig-utils",
"module": "NodeNext",
"resolveJsonModule": true,
"types": ["node", "vitest/globals", "vitest/importMeta"]
"outDir": "../../dist/packages/tsconfig-utils"
},
"include": [
"vitest.config.mts",
"package.json",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts",
"tests"
],
"exclude": ["**/fixtures/**"],
"references": [
{
"path": "./tsconfig.build.json"
Expand Down
5 changes: 0 additions & 5 deletions packages/tsconfig-utils/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ const vitestConfig = mergeConfig(
root: import.meta.dirname,

test: {
diff: {
maxDepth: 1,
},

dir: path.join(import.meta.dirname, 'tests'),
name: packageJson.name.replace('@typescript-eslint/', ''),
root: import.meta.dirname,
testTimeout: 10_000,
},
}),
);
Expand Down
Loading