Need help with setting up Storyshots. I am always getting the following error when I run npm test:
> jest tests
FAIL tests/storyshots.test.js
โ Test suite failed to run
storyshots found 0 stories
2 | import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';
3 |
> 4 | initStoryshots({
| ^
5 | framework: 'html',
6 | integrityOptions: { cwd: path.resolve(__dirname, '../stories') },
7 | configPath: path.resolve(__dirname, '../.storybook'),
at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/api/index.js:108:15)
at Object.<anonymous> (tests/storyshots.test.js:4:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 4.028 s
Ran all test suites matching /tests/i.
(node:20997) ExperimentalWarning: The fs.promises API is experimental
npm ERR! Test failed. See above for more details.
module.exports = {
moduleNameMapper: {
'^.+\\.(css|less|scss)$': 'babel-jest'
},
transform: {
'^.+\\.js$': 'babel-jest'
},
moduleFileExtensions: ['js', 'json']
};
import path from 'path';
import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';
initStoryshots({
framework: 'html',
integrityOptions: { cwd: path.resolve(__dirname, '../stories') },
configPath: path.resolve(__dirname, '../.storybook'),
test: multiSnapshotWithOptions()
});
export default {
title: 'Components|Button',
};
export const basic = () => '<button>Click me!</button>';
I have the same issue with a more minimal setup: on 6.0.0-beta12
/tests/Storyshots.test.js
import initStoryshots from '@storybook/addon-storyshots'
initStoryshots()
/jest.config.js
module.exports = {
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less|scss)$': 'identity-obj-proxy',
},
}
my stories are in src/**/*.story.tsx
my /.storybook/main.js
module.exports = {
stories: ['../src/**/*.story.(tsx|mdx)'],
typescript: {
reactDocgen: 'react-docgen',
},
addons: [
'@storybook/addon-docs',
'@storybook/addon-knobs',
'@storybook/addon-actions',
'@storybook/addon-viewport',
'@storybook/addon-a11y',
'@storybook/addon-links',
],
}
my stories are named like: Card.story.tsx
So, I tried looking at the official live examples but still can't figure out what is the issue. Looks like something is wrong with my configurations. Any help here would be much appreciated.
I've been having the same issue, also found this issue raised https://github.com/storybookjs/storybook/issues/10148. I have a similar setup but am using Vue. All other addons updated fine but no luck with this so far
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
getting error on npm test
Test suite failed to run
storyshots found 0 stories
2 |
3 | import initStoryshots from "@storybook/addon-storyshots";
> 4 | initStoryshots();
| ^
5 |
at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/api/index.js:108:15)
at Object.<anonymous> (src/storybook.test.ts:4:1)
I'm getting the exact same error as @shivamyth - standard cra setup. When I run storybook, it finds my stories just fine, but npm run test gives the error above.
I had similar issues when I put storyshots.test.js under project root folder. When I moved storyshots.test.js to /stories folder, it works.
Bizarre: if I rename next-env.d.ts to anything else, I get storyshots found 0 stories. I rename it back, the error is gone. Even though there's no reference to that file anywhere that Storyshots should be affected by.
This workaround helped me: https://github.com/storybookjs/storybook/issues/12242
Changing typescript.json's jsx:"preserve" to jsx: "react" fixes this issue, though some warnings remain.
I use CRA setup. The workaround is my default config. Storybook runs ok, but storyshots finds nothing. Tried everything but nothing works for me
I'm using latest CRA setup. Storybook works ok and storyshots finds 0 stories.
Most helpful comment
getting error on npm test
Test suite failed to run