Using testers

Use the unified tester CLI, UI and API, to run the different compilers your workspace components use.

Test all modified components:

$bit
Copiedcopy
See command synopsis

The output is similar to the following:

testing total of 3 components in workspace 'my-workspace'

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:

$bit
Copiedcopy

Test in watch mode

Test in watch mode (re-test on component changes):

$bit
Copiedcopy

Test a specific component:

$bit
Copiedcopy

Test a group of components using a glob pattern:

$bit
Copiedcopy

Test with coverage report

Run the following to output the test coverage stats:

$bit
Copiedcopy

The output is similar to the following:

----------------------|---------|----------|---------|---------|------------------- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ----------------------|---------|----------|---------|---------|------------------- All files | 100 | 100 | 100 | 100 | text.composition.tsx | 100 | 100 | 100 | 100 | text.tsx | 100 | 100 | 100 | 100 | ----------------------|---------|----------|---------|---------|-------------------

Output test results to a file (JUnit)

Run the following to write the test results to a file, in a JUnit format:

$bit
Copiedcopy

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>
CopiedCopy

Test during build

Run the following to test during build:

$bit
Copiedcopy

Skip tests during build

Runt he following to skip tests during build:

$bit
Copiedcopy