You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After upgrade to 5.2, all the image snapshot tests are failing. It is because fileName is undefined in context that is exposed from addon-storyshots-puppeteer. I guess it has something to do with a new way we call configure.
To Reproduce
Steps to reproduce the behavior:
Upgrade all packages to 5.2
Change configure to not receive loadStories, but require.context("../packages", true, /.stories.js$/);
Run image snapshot test export APP_ENV=test && yarn docs:build && NODE_ENV=test jest .jest/image_snapshot.test.js --config=.jest/jest.config.js
Expected behavior
All tests pass.
Code snippets
Error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
6 | console.log(Object.keys(context), context.kind, context.story, url);
7 | return {
> 8 | customSnapshotsDir: `${path.dirname(context.fileName)}/__image_snapshots__`,
| ^
9 | customDiffDir: `${path.dirname(context.fileName)}/__image_snapshots__/diff`,
10 | failureThreshold: 0.02,
11 | failureThresholdType: "percent",
import{addDecorator,configure,addParameters}from"@storybook/react";import{withInfo}from"@storybook/addon-info";import{withActions}from"@storybook/addon-actions";importthemefrom"./theme";importStoryWrapperfrom"./storyWrapper";// Automatically import all files ending in *.stories.jsconstreq=require.context("../packages",true,/.stories.js$/);// Apply story wrapper decoratoraddDecorator(StoryWrapper);// You may ask why NODE_ENV and APP_ENV...// That's all because of// env: {// test: {// plugins: ["require-context-hook"],// },// },// When we run unit tests. We need this (NODE_ENV=test) because otherwise// it will fail to require stories in node env - `require.context`// On the other hand - visual tests, running in browser cannot have this plugin// because it will be handled via webpack. Thus APP_ENV=test for modifying behavior// of storybook in visual tests.if(process.env.NODE_ENV==="test"||process.env.APP_ENV==="test"){// Apply decorator that displays story infoaddParameters({info: {disable: true,},});}else{addDecorator(withInfo({inline: true,styles: {infoBody: {border: 0,},},}),);addDecorator(withActions({}));addParameters({options: {theme: theme,},});}configure(req,module);
Babel and Jest are configured with require-context.
@shilman tomorrow is a public holiday in Germany so I think I'll be able to pick it up. What needs to be done is to remove the displayName part in favor of #7878 (comment)
Describe the bug
After upgrade to 5.2, all the image snapshot tests are failing. It is because
fileName
isundefined
incontext
that is exposed fromaddon-storyshots-puppeteer
. I guess it has something to do with a new way we callconfigure
.To Reproduce
Steps to reproduce the behavior:
configure
to not receive loadStories, butrequire.context("../packages", true, /.stories.js$/);
export APP_ENV=test && yarn docs:build && NODE_ENV=test jest .jest/image_snapshot.test.js --config=.jest/jest.config.js
Expected behavior
All tests pass.
Code snippets
Error:
image_snapshot.test.js
.storybook/config
Babel and Jest are configured with
require-context
.System:
The text was updated successfully, but these errors were encountered: