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

Setup Jest test coverage #661

Open
HonkingGoose opened this issue Jan 12, 2022 · 0 comments
Open

Setup Jest test coverage #661

HonkingGoose opened this issue Jan 12, 2022 · 0 comments
Labels
chore Changes that affect the build system, CI config or other changes that don't modify src/test f

Comments

@HonkingGoose
Copy link
Collaborator

What feature would you like to have?

Currently we don't know how much of our code is covered by tests.

After some setup work, we can run Jest with the --coverage true flag to get a Coverage Summary at the end of the run:

=============================== Coverage summary ===============================
Statements   : 100% ( 24413/24413 )
Branches     : 98.11% ( 7964/8117 )
Functions    : 100% ( 2919/2919 )
Lines        : 100% ( 23986/23986 )
================================================================================

Test Suites: 385 passed, 385 total
Tests:       6978 passed, 6978 total
Snapshots:   2002 passed, 2002 total
Time:        600.264 s
Ran all test suites.

What problem will this feature solve?

Know which parts of code are covered by tests.

Once we have covered enough of our code with tests, we can set coverageThreshold 1 in Jest. This means that future code should always be covered with tests, or the coverage will drop below the threshold and Jest will fail the tests.

Do you want to help make the feature?

Yes

Is there anything else we need to know?

The Jest documentation explains how to set up the coverage reports.

https://jestjs.io/docs/configuration

Footnotes

  1. https://jestjs.io/docs/configuration#coveragethreshold-object

@Belco90 Belco90 added chore Changes that affect the build system, CI config or other changes that don't modify src/test f and removed status:requirements enhancement New feature or request labels Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Changes that affect the build system, CI config or other changes that don't modify src/test f
Projects
Status: Todo
Development

No branches or pull requests

2 participants