Skip to content

[v3] Browser Mode: Error when running npx vitest --browser.headless #7300

@marcomuser

Description

@marcomuser

Describe the bug

When I want to run vitest in headless mode via the CLI npx vitest --browser.headless I get the following error: Error: Vitest Browser Mode requires "browser.name" (deprecated) or "browser.instances" options, none were set..

This used to work with v2 and the deprecated browser.name in my workspace config.

Reproduction

I have a vitest workspace defined like this:

export default defineWorkspace([
  {
    test: {
      include: [
        "packages/*/test/unit/**/*.test.{ts,tsx}",
        "packages/*/test/types/**/*.test-d.{ts,tsx}",
      ],
      name: "node",
      environment: "node",
      typecheck: {
        enabled: true,
        tsconfig: "./tsconfig.json",
      },
    },
  },
  {
    test: {
      include: ["packages/*/test/browser/**/*.test.{ts,tsx}"],
      name: "browser",
      browser: {
        enabled: true,
        provider: "playwright",
        instances: [
          {
            browser: "chromium",
          },
        ],
      },
    },
  },
]);

Run npx vitest --browser.headless

System Info

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions