Skip to content

CLI --browser.headless=false doesn't load Vitest UI when using workspaces #7521

@silvenon

Description

@silvenon

Describe the bug

When using (inline) workspaces the CLI option --browser.headless=false doesn't map to the project's browser.headless configuration, it seems to map to the instances instead because my instance opens, but without the Vitest UI, which is how setting headless: false on the instance behaves in combination with top-level headless: true.

npx vitest --project=browser --browser.headless=false
// vite.config.ts

// ...

{
  test: {
    workspace: [
      {
        test: {
          name: 'browser',
          browser: {
            enabled: true,
            headless: true,
            instances: [
              {
                browser: 'chromium',
              },
            ],
          },
        },
      },
    ],
  },
}

The CLI option works fine when not using workspaces, in that case the top-level browser.headless is successfully set to false.

Probably related to #7311.

Reproduction

https://github.com/silvenon/repro/tree/vitest-browser-mode-headless-workspaces

gh repo clone silvenon/repro -- --branch vitest-browser-mode-headless-workspaces
cd repro
npm install
npm test

System Info

System:
    OS: macOS 15.3.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 233.84 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.1 - ~/.n/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.n/bin/npm
    pnpm: 10.1.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.29 - ~/.bun/bin/bun
  Browsers:
    Chrome: 133.0.6943.99
    Edge: 133.0.3065.69
    Safari: 18.3

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerfeat: workspaceIssues and PRs related to the workspace featurep3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions