Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(typescript-estree): finish migrating tovitest#11109

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 ourterms of service andprivacy 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 fromall commits
Commits
Show all changes
20 commits
Select commitHold shift + click to select a range
85e9f25
Update `vitest` to version 3.1.2
aryaemami59Apr 27, 2025
392d6ab
Fix lint issues for `eslint-plugin` issues
aryaemami59Apr 27, 2025
9665a61
chore(typescript-estree): finish migrating to `vitest`
aryaemami59Apr 27, 2025
5931b6b
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59Apr 28, 2025
635fa02
Lint `vitest-custom-matchers.d.ts` files
aryaemami59Apr 28, 2025
bb0f757
Convert `checkNumberArrayType` to a custom assertion
aryaemami59Apr 28, 2025
5be622e
Convert `testIsolatedFile` to a custom assertion
aryaemami59Apr 28, 2025
d42de8d
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59Apr 29, 2025
40a08ab
remove `@types/is-glob`
aryaemami59Apr 29, 2025
23f1d9e
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59Apr 30, 2025
5a26dd7
update `vite` to version 6.3.4
aryaemami59Apr 30, 2025
aef945f
update `chai` to version 5.2.0
aryaemami59Apr 30, 2025
8fc4f1d
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59May 1, 2025
66eb45a
update `@vitest/eslint-plugin` to version 1.1.44
aryaemami59May 1, 2025
dd219b9
Merge branch 'main' of https://github.com/typescript-eslint/typescrip…
aryaemami59May 3, 2025
e18b82e
fix custom matchers
aryaemami59May 3, 2025
15cea38
fix custom matchers
aryaemami59May 3, 2025
6007536
switch `.toEqual` usages to `.toStrictEqual`
aryaemami59May 4, 2025
6212fca
update `vite` to version 6.3.5
aryaemami59May 5, 2025
6ba0ab8
Merge branch 'main'
JoshuaKGoldbergMay 5, 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
7 changes: 5 additions & 2 deletionsknip.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,6 @@ export default {
'@babel/types',
'@nx/js',
'@nx/workspace',
'glob',
'make-dir',
// imported for type purposes only
'website',
Expand DownExpand Up@@ -112,7 +111,11 @@ export default {

vitest: {
config: ['vitest.config.mts'],
entry: ['tests/lib/**/*.{bench,test,test-d}.?(c|m)ts?(x)'],
entry: [
'tests/lib/**/*.{bench,test,test-d}.?(c|m)ts?(x)',
'tests/test-utils/custom-matchers/custom-matchers.ts',
'tests/test-utils/custom-matchers/vitest-custom-matchers.d.ts',
],
},
},
'packages/utils': {
Expand Down
2 changes: 0 additions & 2 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,7 +71,6 @@
"@types/babel__core": "^7.20.5",
"@types/debug": "^4.1.12",
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
"@types/is-glob": "^4.0.4",
"@types/natural-compare": "^1.4.3",
"@types/node": "^20.12.5",
"@types/semver": "^7.5.8",
Expand All@@ -98,7 +97,6 @@
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-unicorn": "^56.0.0",
"execa": "7.2.0",
"glob": "^10.3.12",
"globals": "^15.0.0",
"husky": "^9.1.4",
"jiti": "2.4.2",
Expand Down
4 changes: 2 additions & 2 deletionspackages/typescript-estree/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,8 +45,7 @@
],
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "tsc -b tsconfig.build.json --clean",
"postclean": "rimraf dist/ coverage/",
"clean": "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": "vitest --run --config=$INIT_CWD/vitest.config.mts",
Expand All@@ -63,6 +62,7 @@
"ts-api-utils": "^2.0.1"
},
"devDependencies": {
"@types/is-glob": "^4.0.4",
"@vitest/coverage-v8": "^3.1.2",
"glob": "*",
"prettier": "^3.2.5",
Expand Down
5 changes: 2 additions & 3 deletionspackages/typescript-estree/tests/lib/convert.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -190,7 +190,6 @@ describe('convert', () => {
maps.esTreeNodeToTSNodeMap.get(maps.tsNodeToESTreeNodeMap.get(ast)),
);

expect(maps.esTreeNodeToTSNodeMap.get(program.body[0])).toBeDefined();
expect(program.body[0]).not.toBe(
maps.tsNodeToESTreeNodeMap.get(ast.statements[0] as TSNode),
);
Expand DownExpand Up@@ -224,7 +223,7 @@ describe('convert', () => {
range: [0, 20],
type: AST_NODE_TYPES.TSAbstractKeyword,
});
expect(convertedNode).toEqual({
expect(convertedNode).toStrictEqual({
loc: {
end: {
column: 25,
Expand DownExpand Up@@ -382,7 +381,7 @@ describe('convert', () => {
esTsEnumDeclaration.members = [];

// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(esTsEnumDeclaration.members).toEqual([]);
expect(esTsEnumDeclaration.members).toStrictEqual([]);
expect(Object.keys(esTsEnumDeclaration)).toContain('members');
});

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ describe(createParseSettings, () => {
projectService: undefined,
});

expect(parseSettings.projectService).toBeUndefined();
assert.isUndefined(parseSettings.projectService);
});

it('is not created when options.projectService is false, options.project is true, and process.env.TYPESCRIPT_ESLINT_PROJECT_SERVICE is true', () => {
Expand All@@ -47,7 +47,7 @@ describe(createParseSettings, () => {
projectService: false,
});

expect(parseSettings.projectService).toBeUndefined();
assert.isUndefined(parseSettings.projectService);
});
});

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,7 +88,7 @@ describe(createProjectService, () => {
it('does not set allowDefaultProject when options.allowDefaultProject is not defined', () => {
const settings = createProjectService(undefined, undefined, undefined);

expect(settings.allowDefaultProject).toBeUndefined();
assert.isUndefined(settings.allowDefaultProject);
});

it('does not throw an error when options.defaultProject is not provided and getParsedConfigFile throws a diagnostic error', () => {
Expand DownExpand Up@@ -308,7 +308,7 @@ describe(createProjectService, () => {
it('does not return a log filename with the default projects logger', () => {
const { service } = createProjectService(undefined, undefined, undefined);

expect(service.logger.getLogFileName()).toBeUndefined();
assert.isUndefined(service.logger.getLogFileName());
});

it('uses the default projects event debugger for event handling when enabled', () => {
Expand All@@ -334,7 +334,7 @@ describe(createProjectService, () => {

const required = service.host.require?.('', '');

expect(required).toEqual({
expect(required).toStrictEqual({
error: {
message:
'TypeScript plugins are not required when using parserOptions.projectService.',
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,12 +41,12 @@ describe(getParsedConfigFile, () => {
getParsedConfigFile(
mockTsserver,
'./tsconfig.json',
path.relative('./',path.dirname(__filename)),
path.relative('./',__dirname),
);
expect(mockGetParsedCommandLineOfConfigFile).toHaveBeenCalledOnce();
const [_configFileName, _optionsToExtend, host] =
mockGetParsedCommandLineOfConfigFile.mock.calls[0];
expect(host.getCurrentDirectory()).toBe(path.dirname(__filename));
expect(host.getCurrentDirectory()).toBe(__dirname);
});

it('resolves an absolute project directory when passed', () => {
Expand DownExpand Up@@ -108,7 +108,7 @@ describe(getParsedConfigFile, () => {
raw: { compilerOptions: { strict: true } },
};
mockGetParsedCommandLineOfConfigFile.mockReturnValue(parsedConfigFile);
expect(getParsedConfigFile(mockTsserver, 'tsconfig.json')).toEqual(
expect(getParsedConfigFile(mockTsserver, 'tsconfig.json')).toStrictEqual(
expect.objectContaining(parsedConfigFile),
);
});
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,15 +37,15 @@ describe(getProjectConfigFiles, () => {

const actual = getProjectConfigFiles(parseSettings, project);

expect(actual).toEqual([project]);
expect(actual).toStrictEqual([project]);
});

it('returns the project when given as a string array', () => {
const project = ['./tsconfig.eslint.json'];

const actual = getProjectConfigFiles(parseSettings, project);

expect(actual).toEqual(project);
expect(actual).toStrictEqual(project);
});

describe('it does not enable type-aware linting when given as', () => {
Expand All@@ -65,7 +65,7 @@ describe(getProjectConfigFiles, () => {
getProjectConfigFiles(parseSettings, true);
const actual = getProjectConfigFiles(parseSettings, true);

expect(actual).toEqual([
expect(actual).toStrictEqual([
path.normalize('repos/repo/packages/package/tsconfig.json'),
]);
expect(mockExistsSync).toHaveBeenCalledOnce();
Expand DownExpand Up@@ -99,7 +99,7 @@ describe(getProjectConfigFiles, () => {
true,
);

expect(actual).toEqual([path.normalize('a/tsconfig.json')]);
expect(actual).toStrictEqual([path.normalize('a/tsconfig.json')]);
expect(mockExistsSync).toHaveBeenCalledTimes(4);
});

Expand DownExpand Up@@ -131,7 +131,7 @@ describe(getProjectConfigFiles, () => {
true,
);

expect(actual).toEqual([path.normalize('a/tsconfig.json')]);
expect(actual).toStrictEqual([path.normalize('a/tsconfig.json')]);
expect(mockExistsSync).toHaveBeenCalledTimes(6);
});
});
Expand All@@ -142,7 +142,7 @@ describe(getProjectConfigFiles, () => {

const actual = getProjectConfigFiles(parseSettings, true);

expect(actual).toEqual([
expect(actual).toStrictEqual([
path.normalize('repos/repo/packages/package/tsconfig.json'),
]);
});
Expand All@@ -154,7 +154,9 @@ describe(getProjectConfigFiles, () => {

const actual = getProjectConfigFiles(parseSettings, true);

expect(actual).toEqual([path.normalize('repos/repo/tsconfig.json')]);
expect(actual).toStrictEqual([
path.normalize('repos/repo/tsconfig.json'),
]);
});

it('throws when searching hits .', () => {
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ describe(parser.parseAndGenerateServices, () => {
filePath: join(PROJECT_DIR, 'nested', 'deep', 'included.ts'),
});

expect(result).toEqual({
expect(result).toStrictEqual({
ast: expect.any(Object),
services: expect.any(Object),
});
Expand All@@ -29,7 +29,7 @@ describe(parser.parseAndGenerateServices, () => {
filePath: join(PROJECT_DIR, 'nested', 'included.ts'),
});

expect(result).toEqual({
expect(result).toStrictEqual({
ast: expect.any(Object),
services: expect.any(Object),
});
Expand Down
25 changes: 12 additions & 13 deletionspackages/typescript-estree/tests/lib/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,10 +114,10 @@ describe(parser.parseAndGenerateServices, () => {
it('should preserve node maps by default for parseAndGenerateServices()', () => {
const noOptionSet = parser.parseAndGenerateServices(code, baseConfig);

expect(noOptionSet.services.esTreeNodeToTSNodeMap).toEqual(
expect(noOptionSet.services.esTreeNodeToTSNodeMap).toStrictEqual(
expect.any(WeakMap),
);
expect(noOptionSet.services.tsNodeToESTreeNodeMap).toEqual(
expect(noOptionSet.services.tsNodeToESTreeNodeMap).toStrictEqual(
expect.any(WeakMap),
);

Expand All@@ -126,12 +126,12 @@ describe(parser.parseAndGenerateServices, () => {
projectConfig,
);

expect(withProjectNoOptionSet.services.esTreeNodeToTSNodeMap).toEqual(
expect.any(WeakMap),
);
expect(withProjectNoOptionSet.services.tsNodeToESTreeNodeMap).toEqual(
expect.any(WeakMap),
);
expect(
withProjectNoOptionSet.services.esTreeNodeToTSNodeMap,
).toStrictEqual(expect.any(WeakMap));
expect(
withProjectNoOptionSet.services.tsNodeToESTreeNodeMap,
).toStrictEqual(expect.any(WeakMap));
});

function checkNodeMaps(setting: boolean): void {
Expand DownExpand Up@@ -218,16 +218,15 @@ describe(parser.parseAndGenerateServices, () => {
}

if (!shouldThrow) {
expect(result?.ast).toBeDefined();
assert.isDefined(result?.ast);

expect({
...result,
services: {
...result?.services,
...result.services,
// Reduce noise in snapshot by not printing the TS program
program:
result?.services.program == null
? 'No Program'
: 'With Program',
result.services.program == null ? 'No Program' : 'With Program',
},
}).toMatchSnapshot();
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -148,7 +148,7 @@ describe('semanticInfo - singleRun', () => {

const resultProgram = parseAndGenerateServices(code, options).services
.program;
expect(resultProgram).toEqual(mockProgram);
expect(resultProgram).toStrictEqual(mockProgram);

// Call parseAndGenerateServices() again to ensure caching of Programs is working correctly...
parseAndGenerateServices(code, options);
Expand DownExpand Up@@ -179,7 +179,7 @@ describe('semanticInfo - singleRun', () => {

const resultProgram = parseAndGenerateServices(code, options).services
.program;
expect(resultProgram).toEqual(mockProgram);
expect(resultProgram).toStrictEqual(mockProgram);

// Call parseAndGenerateServices() again to ensure caching of Programs is working correctly...
parseAndGenerateServices(code, options);
Expand DownExpand Up@@ -212,7 +212,7 @@ describe('semanticInfo - singleRun', () => {

const resultProgram = parseAndGenerateServices(code, options).services
.program;
expect(resultProgram).toEqual(mockProgram);
expect(resultProgram).toStrictEqual(mockProgram);

// Call parseAndGenerateServices() again to ensure caching of Programs is working correctly...
parseAndGenerateServices(code, options);
Expand DownExpand Up@@ -250,7 +250,7 @@ describe('semanticInfo - singleRun', () => {
code,
optionsWithReversedTsconfigs,
).services.program;
expect(resultProgram).toEqual(mockProgram);
expect(resultProgram).toStrictEqual(mockProgram);

// Call parseAndGenerateServices() again to ensure caching of Programs is working correctly...
parseAndGenerateServices(code, options);
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp