question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow customization of storyshots.disable parameter name

See original GitHub issue

The (undocumented?) ability to set parameters: {storyshots: {disabled: true}} on a story is useful, but can be restrictive if doing storyshots testing alongside screenshot testing, a11y testing etc.

Currently excluding stories from storyshots applies to all storyshots and storyshots-puppeteer tests and it runs at the same time as storyKind as the initial list of stories is collected so there is no access via callbacks/config etc .

A config option called storyDisableParameter would be really convenient:

// snapshot tests
initStoryShots({});

// screenshot tests
initStoryshots({
    storyDisableParameter: 'screenshots.disable' // (default: storyshots.disable)
    test: imageSnapshot({
      storybookUrl,
      beforeScreenshot,
      getScreenshotOptions,
      getMatchOptions,
      customizePage: page => page.emulate(device)
    })
});

// a11y tests
initStoryshots({
    storyDisableParameter: 'axeTest.disable' // (default: storyshots.disable)
});

This way I could specify that a test is to be ignored by screenshot testing, but not snapshot testing. Or I could add config for other suites, like if I’m using storyshots-puppeteer to do a11y testing. The current setting removes the story from all tests that use storyshots.

// i want snapshots but not screenshots or axe tests
story.add( 'story', {}, {screenshots: {disable: true}, axeTest: {disable: true}})

// i don't want snapshots or screenshots, but do want axe tests
story.add( 'story', {}, {snapshots: {disable: true}, screenshots: {disable: true}})

I thought it would make sense to follow storyKindRegex and storyNameRegex naming pattern, but I’m not sure if it should be dot syntax to allow sub objects. I think that option is a little more obvious how to use it from seeing the config, but also computationally more odd.

I would be able to have a go at adding this if it’s likely to be accepted, from looking at the source I don’t think it would affect anything when using the current existing settings.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
svewagcommented, Feb 5, 2020
0reactions
danvkcommented, May 10, 2022

This issue is about customizing the storyshots.disable parameter name, which I still don’t believe is possible. This would still be useful for distinguishing between stories you want to disable for storyshots, storyshots-puppeteer, etc. This issue should be reopened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storyshots Addon | Storybook: Frontend workshop for UI ...
Enables Jest done() callback in the StoryShots tests for async testing. See StoryShots for async rendered components for more info. Story Parameters. disable....
Read more >
Storybook Snapshot Testing - In Plain English
To prevent these, Storyshots can be disabled or enabled on a per component or story basis through parameters.storyshots.disable. // stories/Page ...
Read more >
@storybook/addon-storyshots | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Jest - Storyshot - getCustomBrowser - how to manage?
let browser; let afterAll = () => { if (browser) { browser.close(); } ... '--headless', '--disable-setuid-sandbox', '--disable-dev-shm-usage', ...
Read more >
Inline parameter name hints for C# and VB.NET in ReSharper ...
Disable inline parameter hints can be done from the settings as well. A quick way to enable/disable parameter hints is by using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found