storybookjs / test-runner

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

[Bug] Jest: Got error running globalSetup #308

Open ktyagiLinz opened 1 year ago

ktyagiLinz commented 1 year ago

Describe the bug

when running test I get below error

npm run test-storybook test-storybook

TypeError: Jest: Got error running globalSetup - C:\Users\kkumar\code\web\node_modules\@storybook\test-runner\playwright\global-setup.js, reason: Class extends value undefined is not a constructor or null at getPlaywrightEnv (C:\Users\kkumar\code\web\node_modules\jest-playwright-preset\lib\PlaywrightEnvironment.js:59:5) at Object. (C:\Users\kkumar\code\web\node_modules\jest-playwright-preset\lib\PlaywrightEnvironment.js:245:48) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Object.newLoader (C:\Users\kkumar\code\web\node_modules\pirates\lib\index.js:141:7) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Module.require (node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at Object. (C:\Users\kkumar\code\web\node_modules\jest-playwright-preset\index.js:1:18)

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Should run test

Screenshots and/or logs

If applicable, add screenshots and/or logs to help explain your problem.

Environment

Additional context

Add any other context about the problem here.

nikkialgar commented 1 year ago

I had the same error. Moving vite to be a dependency rather than a devDependency fixed it for me.