To learn how to use Jest in an env that uses a different tester, see Jest configuration.
Jest uses the same standard commands used by all testers.
Test all modified components:
The output is similar to the following:
testing 2 components with environment my-org.my-scope/envs/my-react-env
PASS my-scope/ui/heading/heading.spec.tsx
PASS my-scope/ui/heading/heading.spec.tsx
Test Suites: 2 passed, 2 total
Test: 2 passed, 2 total
Time: 1.5s
Run the following to test all components in the workspace, including unmodified:
Test in watch mode (re-test on component changes):
Test a specific component:
Test a group of components using a glob pattern:
Run the following to output the test coverage stats:
The output is similar to the following:
Run the following to write the test results to a file, in a JUnit format:
The output file, results.xml
at the root of the workspace directory, is similar to the following:
<testsuites> <testsuite name="my-org.my-scope/ui/text" timestamp="2023-02-04T17:43:50.741Z" tests="1" failures="0" errors="0" skipped="0"> <testcase classname="text.spec.tsx" name="should render with the correct text" time="0.03"/> </testsuite> </testsuites>
Run the following to test during build:
Runt he following to skip tests during build: