TypeError: Cannot read property 'STORYBOOK_HOOKS_CONTEXT' of undefined
See original GitHub issueDescribe the bug
When running initStoryshots
from import initStoryshots from "@storybook/addon-storyshots"
an error occurs when storyshots starts.
Code snippets
Storyshot code:
import initStoryshots from "@storybook/addon-storyshots"
describe("storybook tests", () => {
initStoryshots({
configPath: "./storybook",
framework: "react-native"
})
})
Error from console:
● storybook tests › Storyshots › Header › Behavior
TypeError: Cannot read property 'STORYBOOK_HOOKS_CONTEXT' of undefined
at node_modules/@storybook/addons/dist/hooks.js:236:38
at node_modules/@storybook/client-api/dist/client_api.js:129:14
at node_modules/@storybook/addons/dist/hooks.js:266:20
at Object.storyFn (node_modules/@storybook/client-api/dist/story_store.js:363:30)
at getRenderedTree (node_modules/@storybook/addon-storyshots/dist/frameworks/react/renderTree.js:22:28)
at node_modules/@storybook/addon-storyshots/dist/test-bodies.js:21:18
at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/api/snapshotsTestsTemplate.js:44:47)
System:
Environment Info:
System:
OS: macOS 10.15
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Browsers:
Chrome: 76.0.3809.132
Safari: 13.0.1
npmPackages:
@storybook/addon-storyshots: ^5.1.11 => 5.2.0
@storybook/react-native: ^5.1.11 => 5.2.0
@storybook/theming: ^5.1.11 => 5.2.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Cannot read property 'key' of undefined storybook react
after this I got another error for Router and I solve it by using StoryRouter from storybook-react-router. Thanks again :) – Aidayg24. Jun...
Read more >storybook cannot read properties of undefined ... - You.com
The TypeError: Cannot read properties of undefined (reading 'type') exception occurs in storybook when one defines the argTypes in the default export object ......
Read more >Storyshots Addon | Storybook: Frontend workshop for UI ...
jest/register-context.js : import registerRequireContextHook from 'babel-plugin-require-context-hook/register'; ...
Read more >@storybook/addon-storyshots - npm
Take a code snapshot of every story automatically with Jest. Latest version: 6.5.15, last published: 4 days ago.
Read more >How to Read React Errors (fix 'Cannot read property of ...
This error usually means you're trying to use .map on an array, but that array isn't defined yet. That's often because the array...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vladstart1 I have imported
merge
function fromlodash
Your error:
You can do:
Yee-haw!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.2 containing PR #8163 that references this issue. Upgrade today to try it out!