Skip to content

vitest init browser creates invalid workspace file #6299

@RobinTail

Description

@RobinTail

Describe the bug

notice two false inside browser:

import { defineWorkspace } from 'vitest/config'

export default defineWorkspace([
  // This will keep running your existing tests.
  // If you don't need to run those in Node.js anymore,
  // You can safely remove it from the workspace file
  // Or move the browser test configuration to the config file.
  'vitest.config.ts',
  {
    extends: 'vitest.config.ts',
    test: {
      browser: {
        enabled: true,
        name: 'chrome',
        provider: 'preview',
false // <— this
false // <— and this
      },
    },
  },
])

Reproduction

yarn exec vitest init browser
yarn exec v1.22.22
◼ This utility will help you set up a browser testing environment.

✔ Choose a language for your tests › TypeScript
✔ Choose a browser provider. Vitest will use its API to control the testing environment › preview
✔ Choose a browser › chrome
✔ Choose your framework › vanilla

System Info

System:
    OS: macOS 14.6
    CPU: (10) arm64 Apple M2 Pro
    Memory: 213.45 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.1 - ~/.nvm/versions/node/v18.20.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.1/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v18.20.1/bin/npm
    pnpm: 8.9.0 - ~/.nvm/versions/node/v18.20.1/bin/pnpm
    bun: 1.1.21 - /opt/homebrew/bin/bun
  Browsers:
    Safari: 17.6
  npmPackages:
    @vitest/browser: ^2.0.5 => 2.0.5 
    @vitest/coverage-istanbul: ^2.0.3 => 2.0.5 
    vitest: ^2.0.3 => 2.0.5

Used Package Manager

yarn

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp3-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