-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storyshots doesn't seem to load Storybook config #2838
Comments
Can you please share your storyshots test file / jest config? and maybe the console output from the test |
I'm using Create React App, so most of the Jest setup is handled there. I do have a import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
// Mock matchMedia
global.window.matchMedia = jest.fn(() => ({
matches: false,
addListener: jest.fn(),
removeListener: jest.fn(),
}))
jest.mock('scroll-to-element', () => 'scroll-to-element') The test file is just import initStoryshots from '@storybook/addon-storyshots'
initStoryshots() Console output is
|
I assume that you need to add a initStoryshots({
configPath: path.join(/* provide path to the .config.js here. */),
}); Is the root tests dir different from the root source dir? |
No, it's the same. I've actually tried initStoryshots({
configPath: '.storybook',
}) But it didn't make a difference. |
Do you have a repo to reproduce the problem? |
I'll try to put one together later 👍 |
Okay I believe this issue is caused by me setting |
Maybe you can provide the rootDir with jest config... Why do you even need this |
All the other tests work fine (My test command is const req = require.context('components', true, /.stories.js$/) really points to |
Maybe as a workaround, you can create another config Also, do you have a repo to reproduce the problem? |
Apologies for the delay @igor-dv. I think https://github.com/denkristoffer/storyshots-test-repo should show the issue. And yeah, I've resorted to duplicating the config for now, it works 👍 |
Released as |
Issue details
I'm trying to set up Storyshots with Jest, but when the test runs it fails with
ENOENT: no such file or directory, scandir '/site/.storybook/components'
However, my Storybook config specifies that my stories are placed together with my components with filenames like
Component.stories.js
:Looks to me like the config file isn't being read or is set up wrong?
Please specify which version of Storybook and optionally any affected addons that you're running
The text was updated successfully, but these errors were encountered: