storybookjs / test-runner

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

[Bug]: Ejecting adds `require` of file that does not exist #479

Closed IanVS closed 1 month ago

IanVS commented 1 month ago

Describe the bug

I ran pnpm test-storybook --eject, and the config file that was created includes

const { getJestConfig } = require('../dist');

Which doesn't exist in my project.

To Reproduce

pnpm test-storybook --eject then try to run the test runner.

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/92814_1717685993908/bin/node
    npm: 10.7.0 - ~/Library/Caches/fnm_multishells/92814_1717685993908/bin/npm
    pnpm: 8.14.2 - ~/Library/Caches/fnm_multishells/92814_1717685993908/bin/pnpm <----- active
  Browsers:
    Safari: 17.5
  npmPackages:
    @storybook/addon-a11y: 8.1.5 => 8.1.5
    @storybook/addon-essentials: 8.1.5 => 8.1.5
    @storybook/addon-interactions: 8.1.5 => 8.1.5
    @storybook/react: 8.1.5 => 8.1.5
    @storybook/react-vite: 8.1.5 => 8.1.5
    @storybook/test: 8.1.5 => 8.1.5
    @storybook/test-runner: ^0.18.2 => 0.18.2
    @storybook/types: 8.1.5 => 8.1.5
    chromatic: ^11.4.0 => 11.4.0
    eslint-plugin-storybook: ^0.8.0 => 0.8.0
    storybook: 8.1.5 => 8.1.5

Additional context

No response

ctanner-move commented 1 month ago

in case you didnt find the short term fix, you need this instead: const { getJestConfig } = require('@storybook/test-runner');

IanVS commented 1 month ago

Yep, thanks, but I think that's what ejecting should add instead of what it does.