-
Notifications
You must be signed in to change notification settings - Fork 21
Unit tests
Unit tests are located in the src
directory side by side with the module that they test (the test for some-module.js
should be named some-module.test.js
and be located in the same directory as some-module.js
).
To run tests, run yarn test
from the root directory. This starts a process that watches for changes in files and re-runs tests after a file is changed. To run tests once, use yarn test --watchAll=false
.
As part of the IRWG’s (Independent Release Working Group’s) effort to improve testing confidence, Terra UI is also shifting to greatly invest in unit tests, and reduce the reliance on end-to-end UI tests. New or modified code is expected to have 80% code coverage and 80% branch coverage, or better.
See:
Unit tests are expected for new and modified code.
More info in:
A coverage report for new code in a PR can be viewed in SonarCloud. Click the "x% Coverage" link in the SonarCloud PR comment or navigate to
https://sonarcloud.io/component_measures?metric=new_coverage&selected=DataBiosphere_terra-ui&id=DataBiosphere_terra-ui&pullRequest=PR_NUMBER
.
To generate a coverage report locally, run yarn test --coverage --watchAll=false
. To view the report in HTML format, open coverage/lcov-report/index.html
.
Terra UI Wiki.
- Getting Started
- Contributor Guide
- Intro to UI Development
- Troubleshooting Build Failures
- Editor Configuration
- BEEs
- Pull Requests
- How to Find a PR Site
- Feature Flags
- Mixpanel
- Cobranding and White-Label Sites
- Using Terra UI packages in other projects