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

test: allow to execute tests on windows#6488

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
JoshuaKGoldberg merged 3 commits intov6fromfix/tests-on-windows
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
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
14 changes: 11 additions & 3 deletionspackages/ast-spec/tests/fixtures.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,10 +38,18 @@ const fixturesWithErrorDifferences = {
} as const;

const VALID_FIXTURES: readonly string[] = glob.sync(
`${SRC_DIR}/**/fixtures/*/fixture.{ts,tsx}`,
`**/fixtures/*/fixture.{ts,tsx}`,
{
cwd: SRC_DIR,
absolute: true,
},
);
const ERROR_FIXTURES: readonly string[] = glob.sync(
`${SRC_DIR}/**/fixtures/_error_/*/fixture.{ts,tsx}`,
`**/fixtures/_error_/*/fixture.{ts,tsx}`,
{
cwd: SRC_DIR,
absolute: true,
},
);

const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map(
Expand All@@ -66,7 +74,7 @@ const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map(
isError: absolute.includes('/_error_/'),
isJSX: ext.endsWith('x'),
name,
relative: path.relative(SRC_DIR, absolute),
relative: path.relative(SRC_DIR, absolute).replace(/\\/g, '/'),
segments,
snapshotFiles: {
success: {
Expand Down
View file
Open in desktop

This file was deleted.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
import path from 'path';

import { ExpiringCache } from '../../src/parseSettings/ExpiringCache';
import { getProjectConfigFiles } from '../../src/parseSettings/getProjectConfigFiles';

Expand DownExpand Up@@ -51,12 +53,16 @@ describe('getProjectConfigFiles', () => {
getProjectConfigFiles(parseSettings, true);
const actual = getProjectConfigFiles(parseSettings, true);

expect(actual).toEqual(['repos/repo/packages/package/tsconfig.json']);
expect(actual).toEqual([
path.normalize('repos/repo/packages/package/tsconfig.json'),
]);
expect(mockExistsSync).toHaveBeenCalledTimes(1);
});

it('returns a nearby parent tsconfig.json when it was previously cached by a different directory search', () => {
mockExistsSync.mockImplementation(input => input === 'a/tsconfig.json');
mockExistsSync.mockImplementation(
input => input === path.normalize('a/tsconfig.json'),
);

const tsconfigMatchCache = new ExpiringCache<string, string>(1);

Expand All@@ -81,12 +87,14 @@ describe('getProjectConfigFiles', () => {
true,
);

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

it('returns a distant parent tsconfig.json when it was previously cached by a different directory search', () => {
mockExistsSync.mockImplementation(input => input === 'a/tsconfig.json');
mockExistsSync.mockImplementation(
input => input === path.normalize('a/tsconfig.json'),
);

const tsconfigMatchCache = new ExpiringCache<string, string>(1);

Expand All@@ -111,7 +119,7 @@ describe('getProjectConfigFiles', () => {
true,
);

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

const actual = getProjectConfigFiles(parseSettings, true);

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

it('returns a parent tsconfig.json when matched', () => {
mockExistsSync.mockImplementation(
filePath => filePath === 'repos/repo/tsconfig.json',
filePath => filePath ===path.normalize('repos/repo/tsconfig.json'),
);

const actual = getProjectConfigFiles(parseSettings, true);

expect(actual).toEqual(['repos/repo/tsconfig.json']);
expect(actual).toEqual([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@@ -42,7 +42,7 @@ describe('parseAndGenerateServices', () => {
filePath: join(PROJECT_DIR, 'notIncluded.ts'),
}),
).toThrow(
/project was set to `true` but couldn't find any tsconfig.json relative to '.+\/tests\/fixtures\/projectTrue\/notIncluded.ts' within '.+\/tests\/fixtures\/projectTrue'./,
/project was set to `true` but couldn't find any tsconfig.json relative to '.+[/\\]tests[/\\]fixtures[/\\]projectTrue[/\\]notIncluded.ts' within '.+[/\\]tests[/\\]fixtures[/\\]projectTrue'./,
);
});
});
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp