Skip to content

describe.concurrent.each() behaves differently than describe.each() #752

@mikeharder

Description

@mikeharder

Describe the bug

In the vitest window, describe.concurrent.each() behaves differently than describe.each(), especially before running tests. In this image, the first three tests are from describe.concurrent.each(), while the last test is a placeholder for a suite of tests.

Image

After running tests, they look more similar:

Image

Expected behavior

describe.concurrent.each() and describe.each() to have the same, or very similar, UI. The only difference should be whether to run suites and tests sequentially or concurrently

Reproduction

Example modified from https://vitest.dev/api/#describe-each:

import { describe, expect, test } from "vitest";

const cases = [
  { a: 1, b: 1, expected: 2 },
  { a: 1, b: 2, expected: 3 },
  { a: 2, b: 1, expected: 3 },
];

const tests = ({ a, b, expected }) => {
  test(`returns ${expected}`, () => {
    expect(a + b).toBe(expected);
  });

  test(`returned value not be greater than ${expected}`, () => {
    expect(a + b).not.toBeGreaterThan(expected);
  });

  test(`returned value not be less than ${expected}`, () => {
    expect(a + b).not.toBeLessThan(expected);
  });
};

describe.each(cases)("sequential add($a, $b)", tests);

describe.concurrent.each(cases)("concurrent add($a, $b)", tests);

Output

[INFO 1:02:16 AM] [API] Resolving configs: vitest-test
[1:02:16 AM] [API] Spawning on-demand process...
[INFO 1:02:16 AM] [API] Running Vitest v4.0.18 (vitest-test) with "/run/user/1000/fnm_multishells/127911_1773123787740/bin/node /home/mharder/.vscode-server/extensions/vitest.explorer-1.48.1/dist/worker.js"
[1:02:16 AM] [API] Vitest WebSocket connection closed, cannot call RPC anymore.
[1:02:16 AM] [API] On-demand process finished in 319ms
[INFO 1:02:16 AM] [API] Watching 
[INFO 1:02:16 AM] [VSCODE] Watching vitest-test with pattern **/*
[INFO 1:02:17 AM] [API] Collecting tests: hello.test.js
[1:02:17 AM] [API] Spawning on-demand process...
[INFO 1:02:17 AM] [API] Running Vitest v4.0.18 (vitest-test) with "/run/user/1000/fnm_multishells/127911_1773123787740/bin/node /home/mharder/.vscode-server/extensions/vitest.explorer-1.48.1/dist/worker.js"
[1:02:17 AM] [API] Vitest WebSocket connection closed, cannot call RPC anymore.
[1:02:17 AM] [API] On-demand process finished in 346ms
[INFO 1:02:37 AM] [API] Running Vitest v4.0.18 (vitest-test) with "/run/user/1000/fnm_multishells/127911_1773123787740/bin/node /home/mharder/.vscode-server/extensions/vitest.explorer-1.48.1/dist/worker.js"
[1:02:37 AM] Enqueuing "returns ${expected}"
[1:02:37 AM] Enqueuing "returned value not be greater than ${expected}"
[1:02:37 AM] Enqueuing "returned value not be less than ${expected}"
[INFO 1:02:37 AM] Running all tests in vitest-test
[INFO 1:02:38 AM] [DECOR] Reset all decorations.
[1:02:38 AM] No task result for "hello.test.js", ignoring
[1:02:38 AM] No task result for "sequential add(1, 1)", ignoring
[1:02:38 AM] Enqueuing "returns 2"
[1:02:38 AM] Enqueuing "returned value not be greater than 2"
[1:02:38 AM] Enqueuing "returned value not be less than 2"
[1:02:38 AM] No task result for "sequential add(1, 2)", ignoring
[1:02:38 AM] Enqueuing "returns 3"
[1:02:38 AM] Enqueuing "returned value not be greater than 3"
[1:02:38 AM] Enqueuing "returned value not be less than 3"
[1:02:38 AM] No task result for "sequential add(2, 1)", ignoring
[1:02:38 AM] Enqueuing "returns 3"
[1:02:38 AM] Enqueuing "returned value not be greater than 3"
[1:02:38 AM] Enqueuing "returned value not be less than 3"
[1:02:38 AM] No task result for "concurrent add(1, 1)", ignoring
[1:02:38 AM] Enqueuing "returns 2"
[1:02:38 AM] Enqueuing "returned value not be greater than 2"
[1:02:38 AM] Enqueuing "returned value not be less than 2"
[1:02:38 AM] No task result for "concurrent add(1, 2)", ignoring
[1:02:38 AM] Enqueuing "returns 3"
[1:02:38 AM] Enqueuing "returned value not be greater than 3"
[1:02:38 AM] Enqueuing "returned value not be less than 3"
[1:02:38 AM] No task result for "concurrent add(2, 1)", ignoring
[1:02:38 AM] Enqueuing "returns 3"
[1:02:38 AM] Enqueuing "returned value not be greater than 3"
[1:02:38 AM] Enqueuing "returned value not be less than 3"
[1:02:38 AM] No errors found for "hello.test.js"
[1:02:38 AM] No errors found for "sequential add(1, 1)"
[1:02:38 AM] Marking "returns 2" as passed
[1:02:38 AM] Marking "returned value not be greater than 2" as passed
[1:02:38 AM] Marking "returned value not be less than 2" as passed
[1:02:38 AM] No errors found for "sequential add(1, 2)"
[1:02:38 AM] Marking "returns 3" as passed
[1:02:38 AM] Marking "returned value not be greater than 3" as passed
[1:02:38 AM] Marking "returned value not be less than 3" as passed
[1:02:38 AM] No errors found for "sequential add(2, 1)"
[1:02:38 AM] Marking "returns 3" as passed
[1:02:38 AM] Marking "returned value not be greater than 3" as passed
[1:02:38 AM] Marking "returned value not be less than 3" as passed
[1:02:38 AM] No errors found for "concurrent add(1, 1)"
[1:02:38 AM] No errors found for "concurrent add(1, 2)"
[1:02:38 AM] No errors found for "concurrent add(2, 1)"
[1:02:38 AM] Marking "returns 2" as passed
[1:02:38 AM] Marking "returned value not be greater than 2" as passed
[1:02:38 AM] Marking "returned value not be less than 2" as passed
[1:02:38 AM] Marking "returns 3" as passed
[1:02:38 AM] Marking "returned value not be greater than 3" as passed
[1:02:38 AM] Marking "returned value not be less than 3" as passed
[1:02:38 AM] Marking "returns 3" as passed
[1:02:38 AM] Marking "returned value not be greater than 3" as passed
[1:02:38 AM] Marking "returned value not be less than 3" as passed
[1:02:38 AM] No errors found for "hello.test.js"
[1:02:38 AM] Ending test run 
[1:02:38 AM] [WORKER]  PASS  Waiting for file changes...

[1:02:38 AM] [WORKER]        press h to show help, press q to quit

[1:02:38 AM] Disposing test runner
[1:02:38 AM] [API] Vitest WebSocket connection closed, cannot call RPC anymore.

Extension Version

1.48.1

Vitest Version

4.0.18

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions