vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Always have to run tests twice when the main describe is not a string

Open JJBocanegra opened this issue 4 months ago • 1 comments

Describe the bug

When a test has a main describe name that is not a string like describe(Service.name) it never run the tests the first time I hit the run button, I need to hit it twice.

The main problem is that with every change in the test code, I will need to hit the button twice too.

Reproduction

Link to repository with reproduction

Output

Incorrect first run

[INFO 12:40:02] Running 1 file(s) with name pattern: ^\s?Service\.name should be true$
[12:40:02] Starting a test run because test/service.test.ts triggered a watch rerun event
[12:40:02] Enqueuing "should be true"
[12:40:03] Ignore "service.test.ts" during collection
[12:40:03] Ignore "Service" during collection
[12:40:03] Marking "should be true" as skipped
[12:40:03] No errors found for "service.test.ts"
[12:40:03] No errors found for "service.test.ts"
[12:40:03] Ending test run test/service.test.ts
[12:40:03] Test run promise is finished, the queue is 0
[12:40:03] [VSCODE] Ignoring file: node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json


Correct second run

[INFO 12:40:33] Running 1 file(s) with name pattern: ^\s?Service should be true$
[12:40:33] Starting a test run because test/service.test.ts triggered a watch rerun event
[12:40:33] Enqueuing "should be true"
[12:40:33] No task result for "service.test.ts", ignoring
[12:40:33] No task result for "Service", ignoring
[12:40:33] Enqueuing "should be true" because it was just collected
[12:40:33] No errors found for "service.test.ts"
[12:40:33] No errors found for "Service"
[12:40:33] Marking "should be true" as passed
[12:40:33] No errors found for "service.test.ts"
[12:40:33] Ending test run test/service.test.ts
[12:40:33] Test run promise is finished, the queue is 0
[12:40:33] [VSCODE] Ignoring file: node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json

Extension Version

1.28.2

Vitest Version

3.2.4

Validations

JJBocanegra avatar Sep 11 '25 11:09 JJBocanegra