-
Notifications
You must be signed in to change notification settings - Fork 21
Unit tests
To run tests for Terra UI, run yarn test
from the root directory.
Each package also has its own set of scripts (test
, etc).
To run tests for a specific package, use yarn workspace
. For example, to run tests for the core-utils
package, run yarn workspace '@terra-ui-packages/core-utils' test
.
To watch for changes in files and automatically re-run tests after a file is changed, use yarn test --watch
.
Unit tests are located 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
).
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