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

[Bug]: No way to select vitest project for addon-test #30673

Open
mrginglymus opened this issue Feb 26, 2025 · 0 comments
Open

[Bug]: No way to select vitest project for addon-test #30673

mrginglymus opened this issue Feb 26, 2025 · 0 comments

Comments

@mrginglymus
Copy link
Contributor

Describe the bug

I'm trying to migrate from test-runner to addon-test. I have an existing suite of tests using vitests browser mode. Whilst running tests from the cli runs fine, attempting to run from the UI results in an error:

Found multiple projects that run browser tests in headed mode: "storybook (chromium)", "default (chromium)". Vitest cannot run multiple headed browsers at the same time. Please, filter projects with --browser=name or --project=name flag or run tests with "headless: true" option.

Presumably we need a way to direct vitest to use the correct project in this block:

this.vitest = await createVitest('test', {
root: vitestWorkspaceConfig ? dirname(vitestWorkspaceConfig) : process.cwd(),
watch: true,
passWithNoTests: false,
// TODO:
// Do we want to enable Vite's default reporter?
// The output in the terminal might be too spamy and it might be better to
// find a way to just show errors and warnings for example
// Otherwise it might be hard for the user to discover Storybook related logs
reporters: ['default', new StorybookReporter(this.testManager)],
coverage: coverageOptions,
});

Reproduction link

https://stackblitz.com/edit/github-7znwqsbf?file=package.json

Reproduction steps

  1. Run storybook in dev mode
  2. Attempt to run tests via UI
  3. Observe error in console

System

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.6.0 => 8.6.0 
    @storybook/addon-onboarding: ^8.6.0 => 8.6.0 
    @storybook/blocks: ^8.6.0 => 8.6.0 
    @storybook/experimental-addon-test: ^8.6.0 => 8.6.0 
    @storybook/react: ^8.6.0 => 8.6.0 
    @storybook/react-vite: ^8.6.0 => 8.6.0 
    @storybook/test: ^8.6.0 => 8.6.0 
    storybook: ^8.6.0 => 8.6.0

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Discussion
Development

No branches or pull requests

3 participants