From de0b49429ed201a7b2ad69359e4f57c4fd0f356f Mon Sep 17 00:00:00 2001 From: Anjey Tsibylskij <130153594+atldays@users.noreply.github.com> Date: Mon, 11 May 2026 22:42:17 +0300 Subject: [PATCH] fix(tests): normalize paths in entrypoint and locale tests --- .../entrypoint/finder/AbstractEntrypointFinder.test.ts | 3 ++- src/locale/LocaleTypes.test.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cli/entrypoint/finder/AbstractEntrypointFinder.test.ts b/src/cli/entrypoint/finder/AbstractEntrypointFinder.test.ts index 19ca6a5..3df4204 100644 --- a/src/cli/entrypoint/finder/AbstractEntrypointFinder.test.ts +++ b/src/cli/entrypoint/finder/AbstractEntrypointFinder.test.ts @@ -3,6 +3,7 @@ import os from "os"; import path from "path"; import AbstractEntrypointFinder from "./AbstractEntrypointFinder"; +import {toPosix} from "@cli/utils/path"; import {ReadonlyConfig} from "@typing/config"; import {EntrypointFile, EntrypointOptions, EntrypointParser, EntrypointType} from "@typing/entrypoint"; @@ -46,7 +47,7 @@ const touch = (file: string): void => { }; const relativeFiles = (root: string, files: Set): string[] => { - return Array.from(files, ({file}) => path.relative(root, file)).sort(); + return Array.from(files, ({file}) => toPosix(path.relative(root, file))).sort(); }; describe("AbstractEntrypointFinder", () => { diff --git a/src/locale/LocaleTypes.test.ts b/src/locale/LocaleTypes.test.ts index 9cc2c1c..d526a6b 100644 --- a/src/locale/LocaleTypes.test.ts +++ b/src/locale/LocaleTypes.test.ts @@ -1,8 +1,13 @@ import path from "path"; import ts from "typescript"; +const normalizeDiagnosticFilename = (filename: string): string => { + return path.normalize(filename).toLowerCase(); +}; + const typecheck = (source: string): string[] => { const filename = path.join(__dirname, "__locale-type-test.ts"); + const normalizedFilename = normalizeDiagnosticFilename(filename); const options: ts.CompilerOptions = { module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler, @@ -33,7 +38,9 @@ const typecheck = (source: string): string[] => { return ts .getPreEmitDiagnostics(program) - .filter(diagnostic => diagnostic.file?.fileName === filename) + .filter(diagnostic => { + return diagnostic.file && normalizeDiagnosticFilename(diagnostic.file.fileName) === normalizedFilename; + }) .map(diagnostic => ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); };