Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/cli/entrypoint/finder/AbstractEntrypointFinder.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -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";
Expand DownExpand Up@@ -46,7 +47,7 @@ const touch = (file: string): void => {
};

const relativeFiles = (root: string, files: Set<EntrypointFile>): string[] => {
return Array.from(files, ({file}) => path.relative(root, file)).sort();
return Array.from(files, ({file}) => toPosix(path.relative(root, file))).sort();
};

describe("AbstractEntrypointFinder", () => {
Expand Down
9 changes: 8 additions & 1 deletion src/locale/LocaleTypes.test.ts
Original file line numberDiff line numberDiff line change
@@ -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,
Expand DownExpand Up@@ -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"));
};

Expand Down
Loading