Skip to content

Commit 4a77b81

Browse files
committed
refactor: use exact path match instead of endsWith in TestResultObserver
PHPUnit details provide absolute paths, so === is correct and avoids false matches when different files share the same filename.
1 parent 8c2dc4e commit 4a77b81

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/extension/src/Observers/TestResultObserver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class TestResultObserver implements TestRunnerObserver {
7575
return message;
7676
}
7777

78-
const matchingDetail = details.find(({ file }) => file.endsWith(resultFile));
78+
const matchingDetail = details.find(({ file }) => file === resultFile);
7979
const line = matchingDetail ? matchingDetail.line - 1 : (test.range?.start.line ?? 0);
8080

8181
message.location = new Location(
@@ -86,7 +86,7 @@ export class TestResultObserver implements TestRunnerObserver {
8686
message.stackTrace = details
8787
.filter(
8888
({ file, line }) =>
89-
file.endsWith(resultFile) && (!matchingDetail || line !== matchingDetail.line),
89+
file === resultFile && (!matchingDetail || line !== matchingDetail.line),
9090
)
9191
.map(
9292
({ file, line }) =>

0 commit comments

Comments
 (0)