Skip to content
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

Feature: Run postVisit on failures #494

Merged
merged 2 commits into from
Nov 28, 2024
Merged

Feature: Run postVisit on failures #494

merged 2 commits into from
Nov 28, 2024

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Jul 16, 2024

Closes #

Release notes

The test-runner's postVisit hook now runs even if there are failures. This allows you to, for instance, take snapshots on component failures. You can check whether the test has failed via the hasFailure property in the context passed to the hook:

const config: TestRunnerConfig = {
  async postVisit(_page, context) {
    if(context.hasFailure) {
      console.log('problems!')
      // do a snapshot, write a log, or anything you like
    }
  },
}

Checklist for Contributors

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes in this repository
  • Request documentation updates in the test-runner docs website

Checklist for Maintainers

  • Make sure this PR contains one of the labels below:

    Available labels
    • skip-release: Skip any releases, e.g., documentation only changes, CI config etc.
    • patch: Upgrade patch version (e.g. 0.0.x)
    • minor: Upgrade patch version (e.g. 0.x.0)
    • major: Upgrade patch version (e.g. x.0.0)
📦 Published PR as canary version: 0.20.0--canary.494.3f8071b.0

✨ Test out this PR locally via:

npm install @storybook/[email protected]
# or 
yarn add @storybook/[email protected]

@yannbf yannbf added the patch Increment the patch version when merged label Jul 16, 2024
@yannbf yannbf marked this pull request as ready for review November 21, 2024 16:02
@yannbf yannbf requested a review from kasperpeulen as a code owner November 21, 2024 16:02
@yannbf yannbf added minor Increment the minor version when merged and removed patch Increment the patch version when merged labels Nov 28, 2024
@yannbf yannbf merged commit 322bd62 into next Nov 28, 2024
12 checks passed
@yannbf yannbf deleted the post-visit-on-failures branch November 28, 2024 09:39
Copy link

🚀 PR was released in v0.20.0-next.2 🚀

@yannbf yannbf mentioned this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged prerelease
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant