generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Support code coverage #120
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shilman
approved these changes
Jun 13, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
shilman
requested changes
Jun 13, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also shouldn't this be a minor release?
yannbf
added
minor
Increment the minor version when merged
and removed
patch
Increment the patch version when merged
labels
Jun 13, 2022
shilman
approved these changes
Jun 15, 2022
yannbf
force-pushed
the
yann/sb-382-test-runner-test-coverage-support
branch
from
June 21, 2022 08:45
8ae5160
to
86b6b43
Compare
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #116
Release Notes
Support code coverage (#120)
Features
Setting up code coverage
The test runner supports code coverage with the
--coverage
flag orSTORYBOOK_COLLECT_COVERAGE
environment variable. The pre-requisite is that your components are instrumented using istanbul.Instrument the code
Given that your components' code runs in the context of a real browser, they have to be instrumented so that the test runner is able to collect coverage. In order to do so, you have to setup the instrumentation yourself.
Install the istanbul babel plugin:
Storybook allows code transpilation with babel out of the box by configuring the
babel
function in yourmain.js
. Add theistanbul
plugin:The babel plugin has default options that might suffice to your project, however if you want to know which options are taken into account you can check them here.
Run tests with --coverage flag
After setting up instrumentation, run Storybook then run the test-runner with
--coverage
:The test runner will report the results in the CLI and generate a
.nyc_output/coverage.json
file which can be used bynyc
.📦 Published PR as canary version:
0.2.0--canary.120.86b6b43.0
✨ Test out this PR locally via:
Version
Published prerelease version:
v0.3.0-next.0
Changelog
Release Notes
Support code coverage (#120)
Support code coverage (#120)
🚀 Enhancement
Authors: 1