vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Add support for `browser.instances[].fileParallelism`

Open AriPerkkio opened this issue 8 months ago • 0 comments

Clear and concise description of the problem

I'm seeing flakiness with Firefox when running test files parallel. Turning off fileParallelism seems to work.

I have chromium in browser.instances too, that is able to run all files parallel quick and stable. Setting top-level fileParallelism: false is not ideal.

Suggested solution

import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    browser: {
      enabled: true,
      provider: 'playwright',

      instances: [
        // Run all tests parallel with Chromium, it's stable
        { browser: "chromium" }, // resolves to default fileParallelism: true

        // Firefox is flaky, run tests without parallelism 
        { browser: "firefox", fileParallelism: false },
      ],
    },
  },
});

Alternative

Right now I'm using following script:

"scripts": {
  "test": "vitest --project chromium && vitest --project firefox --no-file-parallelism"
}

Additional context

No response

Validations

AriPerkkio avatar Apr 30 '25 13:04 AriPerkkio