@storybook/addon-storyshots supports only main.js
See original GitHub issueDescribe the bug
The getMainFile
method of the storyshots addon has a hardcoded name for the new configuration style for version 5.3 of main.js
. This prevents usage of TypeScript, for example, where the file is main.ts
.
You can see the file name here: https://github.com/storybookjs/storybook/blob/76c3f3a6403aeeac6175a4d086c7b35c087f0d52/addons/storyshots/storyshots-core/src/frameworks/configure.ts#L47
It seems the getPreviewFile
method correctly supports both JS and TS files.
This results in storyshots failing with storyshots found 0 stories
.
If I edit this method to also include TS files, it seems to start working again:
const getMainFile = (configDir: string): string | false => {
const main = path.join(configDir, 'main.js');
const mainTS = path.join(configDir, 'main.ts');
if (isFile(main)) {
return main;
}
if (isFile(mainTS) {
return mainTS;
}
return false;
};
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Storyshots Addon | Storybook: Frontend workshop for UI ...
NOTE: if you are using Storybook 5.3's main.js to list story files, this is no longer ... Storyshots addon is currently supporting React,...
Read more >@storybook/addon-storyshots | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >spring-media/storybook-addon-image-snapshots - Socket.dev
Storybook plugin for taking image snapshots of your stories based on @storybook/addon-storyshots-puppeteer plugin.
Read more >Storybook Addon StoryShots for Angular 12 - Stack Overflow
As I kept Karma/Jasmine for unit testing (bigger community), Jest is only for snapshots tests with Storybook , so my jest.config.js is under...
Read more >MIGRATION.md - Storybook - Fossies
New Angular storyshots format; Deprecated Angular story component; New Angular renderer ... Consistent local addon paths in main.js; Deprecated setAddon ...
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 FreeTop 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
Top GitHub Comments
Cool, working now!
Although it seems only
module.exports
works, when usingexport default
causes no configuration to be found.So
main.ts
works – played around with it yesterday – tho AFAICT support for it is entirely accidental. @mrmckeb and I played around for a few minutes and couldn’t figure out WHY it works (thatserverRequire
is doing something tricky cc @igor-dv ). At any rate, will merge the fix. Thanks @iiroj !!!