Skip to content

Reporting regression in V4: incorrect per-test duration with concurrent #10069

@dbousamra

Description

@dbousamra

Describe the bug

After upgrading from Vitest v3 to v4, there are two issues:

  1. Incorrect test duration reporting
  • Tests that clearly run sequentially (~10s each) are reported as taking ~20s each.
  • The total suite duration is correct, but per-test timings are inflated.
  1. Perceived performance regression
  • Our full test suite (~300 tests) increased from ~42s (v3) to ~166s (v4).
  • This appears unrelated to the reporting issue, but may be connected to concurrency changes in v4.

Expected:

  • Each test should report its actual execution time (~10s in the example).
  • Test runtime should remain roughly consistent with v3 under equivalent config.

Actual:

  • Each test reports the total elapsed time of the suite segment (~20s).
  • Suite runtime is significantly slower in v4.

Reproduction

import { describe, it } from 'vitest';

const delay = (ms: number) => new Promise((r) => setTimeout(r, ms));

describe.concurrent('Blah', () => {
  it('1', async () => {
    console.log('Started test 1');
    await delay(10000);
    console.log('Finished test 1');
  });

  it('2', async () => {
    console.log('Started test 2');
    await delay(10000);
    console.log('Finished test 2');
  });
});

Vitest config:

import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    include: ['tests/**/*.test.ts'],
    maxConcurrency: 1,
    maxWorkers: 1,
  },
});

Observed output:

Started test 1
Finished test 1
Started test 2
Finished test 2

✓ 1  ~20s
✓ 2  ~20s

Even though each test only waits 10s.

Full reproduction (StackBlitz):
https://stackblitz.com/edit/vitest-dev-vitest-1p3gv87f?file=vite.config.ts

System Info

System:
    OS: macOS 26.3
    CPU: (18) arm64 Apple M5 Pro
    Memory: 447.06 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.0.2 - /Users/dbousamra/.nvm/versions/node/v24.0.2/bin/node
    Yarn: 3.5.1 - /opt/homebrew/bin/yarn
    npm: 11.3.0 - /Users/dbousamra/.nvm/versions/node/v24.0.2/bin/npm
    pnpm: 10.11.0 - /Users/dbousamra/Library/pnpm/pnpm
    bun: 1.3.3 - /Users/dbousamra/.bun/bin/bun
    Deno: 2.5.6 - /Users/dbousamra/.deno/bin/deno
  Browsers:
    Chrome: 146.0.7680.178
    Firefox: 148.0
    Safari: 26.3

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-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