test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

[Bug] Cannot find module '@storybook/store'

Open MiguelNiblock opened this issue 3 years ago • 1 comments

Getting this error when running yarn test-storybook just after install.

To reproduce, you can simply apply the instructions at https://github.com/storybookjs/test-runner#getting-started onto the react native template at https://github.com/dannyhw/expo-template-storybook.

Could somebody provide a working example project with the test runner? I would like to see what versions it uses. Else, it would be great to know more about the requirements for this to actually work.

Yes, I did run the project on port 6006. In the case of that template, it runs the storybook react server in port 6006 for react native web.

yarn run v1.22.18
$ /home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/.bin/test-storybook
node:internal/modules/cjs/loader:944
  throw err;
  ^

Error: Cannot find module '@storybook/store'
Require stack:
- /home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywright.js
- /home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywrightJson.js
- /home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/bin/test-storybook.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywright.js:12:14)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywright.js',
    '/home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywrightJson.js',
    '/home/user/MyProjects/farmGen_GrownBy/grownby/node_modules/@storybook/test-runner/bin/test-storybook.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

From my package.json:

    "@storybook/addon-actions": "~6.3",
    "@storybook/addon-controls": "~6.3",
    "@storybook/addon-essentials": "~6.3",
    "@storybook/addon-links": "~6.3",
    "@storybook/addon-ondevice-actions": "^6.0.1-beta.6",
    "@storybook/addon-ondevice-backgrounds": "^6.0.1-beta.6",
    "@storybook/addon-ondevice-controls": "^6.0.1-beta.6",
    "@storybook/addon-ondevice-notes": "^6.0.1-beta.6",
    "@storybook/addon-react-native-web": "^0.0.18",
    "@storybook/react": "~6.3",
    "@storybook/react-native": "^6.0.1-beta.6",
    "@storybook/test-runner": "^0.1.1",

    "jest": "27",
    "jest-expo": "^43.0.0",

MiguelNiblock avatar Jun 20 '22 04:06 MiguelNiblock

Hey @MiguelNiblock! We haven't seen a lot of people using the test runner in a react-native project (in combination with react-native-web), but I checked the example repo you shared and the test runner does work! I just had to add @babel/preset-typescript to it. I did not have the issue you described. There were some changes in the Storybook test runner package so that might fix your issue! Could you try again using a newer version of the test runner?

yannbf avatar Sep 28 '22 08:09 yannbf

I'll be closing this issue as it's been inactive and we need a reproduction (as the one provided does work). Feel free to reopen this issue if you think it should!

yannbf avatar Nov 07 '22 10:11 yannbf