storybookjs / test-runner

🚕 Turn stories into executable tests
https://storybook.js.org/docs/writing-tests/interaction-testing
MIT License
229 stars 72 forks source link

[Bug]: After ejecting, `setupFilesAfterEnv` cannot be used #503

Open IanVS opened 2 months ago

IanVS commented 2 months ago

Describe the bug

I wanted to try setting up automatic retries, so I ejected my jest config, and added a setupFilesAfterEnv. But when running tests, I got TypeError: globalThis.__sbPostVisit is not a function when a failure happened in a test.

To Reproduce

System

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/Library/Caches/fnm_multishells/5945_1721245515083/bin/node
    npm: 10.2.4 - ~/Library/Caches/fnm_multishells/5945_1721245515083/bin/npm
    pnpm: 8.14.2 - ~/Library/Caches/fnm_multishells/5945_1721245515083/bin/pnpm <----- active
  Browsers:
    Edge: 127.0.2651.86
    Safari: 17.5
  npmPackages:
    @storybook/addon-a11y: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/addon-essentials: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/addon-interactions: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/react: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/react-vite: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/test: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    @storybook/test-runner: 0.19.2--canary.494.7268a7d.0 => 0.19.2--canary.494.7268a7d.0
    @storybook/types: ^8.2.0-alpha.10 => 8.2.0-alpha.10
    chromatic: ^11.4.0 => 11.4.0
    eslint-plugin-storybook: ^0.8.0 => 0.8.0
    storybook: ^8.2.0-alpha.10 => 8.2.0-alpha.10

Additional context

Using setupFiles instead works fine.