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

Improve code coverage for coverage merging #130

Merged
merged 8 commits into from
Jun 24, 2022
Merged

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Jun 24, 2022

This PR:

  • Updates the coverage functionality to generate a coverage/storybook/coverage-storybook.json file after running with --coverage
  • Uses @storybook/addon-coverage internally
  • Updates README for better instructions, including usage of @storybook/addon-coverage
  • Separates testing workflows and sets up Codecov

If people use tools like Codecov and generate multiple coverage reports (e.g. Jest + Storybook), Codecov will detect them automatically and merge them. For people who want to make a full coverage map locally, they will have to do a bit of scripting:

  • Move coverage/storybook/coverage-storybook.json to coverage/coverage-storybook.json
  • Run npx nyc report --reporter=lcov -t coverage --report-dir coverage
📦 Published PR as canary version: 0.2.1--canary.130.4d54d5b.0

✨ Test out this PR locally via:

npm install @storybook/test-runner@0.2.1--canary.130.4d54d5b.0
# or 
yarn add @storybook/test-runner@0.2.1--canary.130.4d54d5b.0

Version

Published prerelease version: v0.3.0-next.1

Changelog

Release Notes

Support code coverage (#120)

Support code coverage (#120)


🚀 Enhancement

🐛 Bug Fix

  • Improve code coverage for coverage merging #130 (@yannbf)

Authors: 1

@yannbf yannbf self-assigned this Jun 24, 2022
@yannbf yannbf added the patch Increment the patch version when merged label Jun 24, 2022
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. So, to confirm, json reports can be merged across directories? From our earlier conversation I was under the impression that the two json files needed to be in the same directory.

@yannbf
Copy link
Member Author

yannbf commented Jun 24, 2022

This looks good to me. So, to confirm, json reports can be merged across directories? From our earlier conversation I was under the impression that the two json files needed to be in the same directory.

They are extracted automatically by tools like Codecov. Tools like nyc do not merge across directories. I added a recipe for that

@yannbf yannbf changed the title Prepare code coverage for merging Improve code coverage for coverage merging Jun 24, 2022
@yannbf yannbf merged commit 668e56c into next Jun 24, 2022
@yannbf yannbf mentioned this pull request Jun 24, 2022
@yannbf yannbf mentioned this pull request Jul 12, 2022
@yannbf yannbf deleted the feat/code-coverage-merge branch November 18, 2022 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants