-
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.
To watch for changes in files and automatically re-run tests after a file is changed, use yarn test --watch
.
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.
See:
Unit tests are expected for new and modified code.
More info in:
New or modified code is expected to have 80% code coverage and 80% branch coverage, or better.
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
. 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