Closed eddiemonge closed 6 years ago
I had to add
if (process.env.NODE_ENV === 'test') {
require('babel-plugin-require-context-hook/register')()
}
to the storybook/config file as having it in jest/config didn't work.
I don't know if that is a bug here or in Jest or in Babel or a bug at all.
I have the same problem for this. Does anyone can help us?
@eddiemonge I solved it. I created a jest_setup.js in my .storybook folder for jest and wrote the code below as
import registerRequireContextHook from 'babel-plugin-require-context-hook/register';
registerRequireContextHook();
And last, I added the config
setupFiles: [
'./.storybook/jest_setup.js'
]
in my jest.config.js
@bob76828 That worked. That's the part I was not understanding. when I read put it in jests setup file, I thought it meant its config, not its actual setupFiles