Skip to content

Total test duration is wrong in --merge-reports #7825

@kettanaito

Description

@kettanaito

Describe the bug

When merging reports from a sharded test run, the merged report prints an incorrect total duration:

npx vitest run --merge-reports

 ✓ src/one.test.ts (500 tests) 268ms
 ✓ src/two.test.ts (500 tests) 266ms

 Test Files  2 passed (2)
      Tests  1000 passed (1000)
   Start at  11:48:26
   Duration  6ms (transform 0ms, setup 0ms, collect 25ms, tests 534ms, environment 0ms, prepare 86ms)
             ^^^

The tests have clearly taken more time than 6ms to run. It is also apparent from the detailed timings in parenthesis.

It seems that the total time here is of the --merge-report command itself, not the total time of the merged tests, which can be misleading.

Reproduction

You can reproduce this issue by following the Sharing recipe from the Vitest docs. No additional changes were made.

System Info

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: reportersIssues and PRs related to Vitest reportersp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions