Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running browser tests gradually decreases parallelism #7616

Open
6 tasks done
nstepien opened this issue Mar 6, 2025 · 1 comment
Open
6 tasks done

Running browser tests gradually decreases parallelism #7616

nstepien opened this issue Mar 6, 2025 · 1 comment

Comments

@nstepien
Copy link
Contributor

nstepien commented Mar 6, 2025

Describe the bug

We've migrated our biggest codebase (>200 test suites) to using Vitest's Browser Mode.

I've noticed that, when running all the tests, at first Vitest runs as many test suites in parallel as possible, but the amount of parallel test suites gradually decreases as it's making progress, all the way down to only 1 test suite running at any one time.

This has a huge impact on overall test time, especially in CI.

Reproduction

Our codebase isn't public, and I don't know the exact root cause, so I'm not sure I can provide a useful reproducible repo.

I can narrow our config down to this:

    test: {
      include: ['src/**/*.test.{ts,tsx}'],
      globals: true,
      browser: {
        enabled: true,
        headless: true,
        provider: 'playwright',
        commands: { resizeViewport },
        viewport: { width: 1920, height: 1080 },
        instances: [{ browser: 'chromium' }]
      },
      setupFiles: [
        'src/styles.ts',
        'vitest/setup.ts',
        'vitest/hooks.ts',
        'vitest/failOnConsole.ts'
      ]
    }

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (64) x64 AMD Ryzen Threadripper 3970X 32-Core Processor
    Memory: 20.93 GB / 31.88 GB
  Binaries:
    Node: 23.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.1.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @vitejs/plugin-react: ^4.3.4 => 4.3.4
    @vitest/browser: ^3.0.7 => 3.0.7
    @vitest/coverage-v8: ^3.0.7 => 3.0.7
    playwright: ^1.50.1 => 1.50.1
    vite: ^6.2.0 => 6.2.0
    vitest: ^3.0.7 => 3.0.7

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

Yeah, currently it's kind of a fake parallelisation. It's doesn't use the same mechanism that Node.js tests use for parallelisation. It just starts specific tests in several tabs, and they don't communicate between each other when one is free to run other tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants