vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Vitest runs on files with same name but different paths cause results to not be saved

Open seriouslag opened this issue 5 months ago • 0 comments

Describe the bug

If I have two different test files with the same name, they show up fine in the UI, but the test results do not persist from the run of the other file.

Attached a screen recording showing this, I have 3 files client.spec.ts, client2.spec.ts client.spec.ts

When I run client.spec.ts, it is good, when I run client2.spec.ts it is fine, when I run the second client.spec.ts, then the first client.spec.ts results are removed.

Expected output would be test results for outputs of tests at different paths are retained regardless of like file names.

I do not intend to submit a PR.

https://github.com/user-attachments/assets/56a31f2f-191f-4cd7-a325-51e7c1e4e7b6

Reproduction

Create repo with 3 test files in different paths,

Output

[INFO 1:10:07 PM] Running 1 file(s) with name pattern: ^\s?Generated API Client2 Client Configuration2 should create client2$
[1:10:07 PM] Starting a test run because libs/backend/companies-gen-api/src/client2.spec.ts triggered a watch rerun event
[1:10:07 PM] Enqueuing "should create client2"
[1:10:07 PM] No task result for "client2.spec.ts", ignoring
[1:10:07 PM] No task result for "Generated API Client2", ignoring
[1:10:07 PM] No task result for "Client Configuration2", ignoring
[1:10:07 PM] Enqueuing "should create client2" because it was just collected
[1:10:07 PM] No errors found for "client2.spec.ts"
[1:10:07 PM] No errors found for "Generated API Client2"
[1:10:07 PM] No errors found for "Client Configuration2"
[1:10:07 PM] Marking "should create client2" as passed
[1:10:07 PM] No errors found for "client2.spec.ts"
[1:10:07 PM] Ending test run libs/backend/companies-gen-api/src/client2.spec.ts
[1:10:07 PM] Test run promise is finished, the queue is 0
[1:10:08 PM] [VSCODE] File changed: .vite/libs/backend/companies-gen-api/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json
[INFO 1:10:11 PM] Running 1 file(s) with name pattern: ^\s?Generated API Client Client Configuration should create client$
[1:10:11 PM] Starting a test run because libs/backend/temporal-workflows-gen-api/src/client.spec.ts triggered a watch rerun event
[1:10:11 PM] Ending test run libs/backend/temporal-workflows-gen-api/src/client.spec.ts
[1:10:11 PM] Test run promise is finished, the queue is 0
[1:10:11 PM] [VSCODE] File changed: .vite/libs/backend/eligibility-gen-api/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json
[INFO 1:10:13 PM] Running 1 file(s): libs/backend/enrollments-gen-api/src/client.spec.ts
[1:10:13 PM] Starting a test run because libs/backend/enrollments-gen-api/src/client.spec.ts triggered a watch rerun event
[1:10:14 PM] No task result for "client.spec.ts", ignoring
[1:10:14 PM] No task result for "Generated API Client", ignoring
[1:10:14 PM] No task result for "Client Configuration", ignoring
[1:10:14 PM] Enqueuing "should create client" because it was just collected
[1:10:14 PM] No errors found for "client.spec.ts"
[1:10:14 PM] No errors found for "Generated API Client"
[1:10:14 PM] No errors found for "Client Configuration"
[1:10:14 PM] Marking "should create client" as passed
[1:10:14 PM] No errors found for "client.spec.ts"
[1:10:14 PM] Ending test run libs/backend/enrollments-gen-api/src/client.spec.ts
[1:10:14 PM] Test run promise is finished, the queue is 0
[1:10:14 PM] [VSCODE] File changed: .vite/libs/backend/enrollments-gen-api/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json

Extension Version

1.26.4

Vitest Version

3.2.4

Validations

seriouslag avatar Aug 01 '25 17:08 seriouslag