Skip to content

Browser mode tests slow down all tests in Github Actions #9323

@janpe

Description

@janpe

Describe the bug

I'm in the process of migrating some tests in a project to run in browser mode. I currently have 507 tests and I started by migrating 3 of those to browser mode. I have made the following changes to my config:

Before

test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: ['./vitest.setup.js'],
    watch: false,
}

After

test: {
    globals: true,
    watch: false,
    projects: [
      {
        extends: true,
        test: {
          name: 'jsdom',
          environment: 'jsdom',
          setupFiles: ['./vitest.setup.js'],
          include: defaultInclude,
          exclude: browserInclude,
        },
      },
      {
        extends: true,
        test: {
          name: 'browser',
          browser: {
            provider: playwright(),
            enabled: true,
            headless: true,
            instances: [{ browser: 'chromium' }],
          },
          include: browserInclude,
        },
      },
    ],
}

Making these changes almost doubles the time it takes to run all the tests even though the 3 browser tests run quite quickly. The browser tests are run initially and after this the jsdom tests run but much slower than usual. Locally on my computer I cannot see a significant change between these cases.

Before
Duration 284.83s (transform 3.58s, setup 121.86s, import 73.16s, tests 23.10s, environment 39.53s)

After
Duration 473.52s (transform 5.90s, setup 203.70s, import 118.68s, tests 45.82s, environment 64.73s)

I have seen some similar discussion here: #6223

Reproduction

I currently have no reproduction since the project is private and this needs a CI setup to be reproduced.

System Info

Only happens on Github Actions

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions