Skip to content

[Bug]: should Play execute with !test? #32070

@unional

Description

@unional

Describe the bug

export const ShouldNotPlay = {
  tags: ['!test'],
  // ...,
  play() {
    throw new Error('should not run')
  }
}

Should the play function be skip entirely when the story should be skipped in test?

Reproduction link

https://stackblitz.com/edit/github-hz24mwh1?file=src%2Fstories%2FButton.stories.ts

Reproduction steps

No response

System

Storybook Environment Info:

  System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.local/state/fnm_multishells/74377_1752789396540/bin/node
    npm: 10.8.3 - ~/.local/state/fnm_multishells/74377_1752789396540/bin/npm
    pnpm: 10.11.1 - ~/.nvm/versions/node/v20.12.2/bin/pnpm <----- active
  Browsers:
    Chrome: 138.0.7204.158
    Safari: 18.5
  npmPackages:
    @storybook/addon-a11y: catalog: => 9.0.17 
    @storybook/addon-designs: catalog: => 10.0.1 
    @storybook/addon-docs: catalog: => 9.0.17 
    @storybook/addon-links: catalog: => 9.0.17 
    @storybook/addon-vitest: catalog: => 9.0.17 
    @storybook/react-vite: catalog: => 9.0.17 
    storybook: catalog: => 9.0.17 
    storybook-addon-tag-badges: catalog: => 2.0.0 
    storybook-addon-test-codegen: catalog: => 2.0.0 
    storybook-addon-vis: catalog: => 2.1.1 
    storybook-dark-mode2: catalog: => 5.0.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions