Skip to content

Commit 574beaa

Browse files
committed
chore(plugin-typescript-e2e): adjust checks for windows
1 parent a0b5814 commit 574beaa

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

e2e/plugin-typescript-e2e/tests/__snapshots__/collect.e2e.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ exports[`PLUGIN collect report with typescript-plugin NPM package > should run p
121121
"details": {
122122
"issues": [
123123
{
124-
"message": "TS6059: File exclude/utils.ts' is not under 'rootDir' './src'. 'rootDir' is expected to contain all source files.",
124+
"message": "TS6059: File './exclude/utils.ts' is not under 'rootDir' './src'. 'rootDir' is expected to contain all source files.",
125125
"severity": "error",
126126
"source": {
127127
"file": "tmp/e2e/plugin-typescript-e2e/src/6-configuration-errors.ts",

e2e/plugin-typescript-e2e/tests/collect.e2e.test.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ function sanitizeReportPaths(report: Report): Report {
1919
plugins: report.plugins.map(plugin => ({
2020
...plugin,
2121
audits: osAgnosticAuditOutputs(plugin.audits, message =>
22-
message.replaceAll(/['"]([^'"]*[/\\][^'"]*)['"]/g, (p: string) => {
23-
const osAgnostic = osAgnosticPath(p);
24-
if (osAgnostic.endsWith('.ts')) {
25-
return osAgnostic;
26-
}
27-
return osAgnostic.split('/').slice(-1).join('/');
28-
}),
22+
message.replace(
23+
/['"]([^'"]*[/\\][^'"]*)['"]/g,
24+
(fullMatch: string, capturedPath: string) => {
25+
const osAgnostic = osAgnosticPath(capturedPath);
26+
// Only replace directory paths, not .ts file paths
27+
if (capturedPath.endsWith('.ts')) {
28+
return `'${osAgnostic}'`;
29+
}
30+
// on Windows the path starts from "D/" not "./". This normalizes it to "./<segment>"
31+
return `'${['.'].concat(osAgnostic.split('/').slice(-1)).join('/')}'`;
32+
},
33+
),
2934
),
3035
})),
3136
};

0 commit comments

Comments
 (0)