Tester Overview

The Tester provides a unified interface for testing components regardless of the specific tester they use.

Software testing is a way to validate that an application, or a module of it, behaves as expected.

Web applications and services are often tested using a set of testing tools, where each tool plays a different role. For example, Jest can be used as a test runner and as an assertion library, while React Testing Library can be used for testing interfaces.

The Tester aspect is responsible for standardizing test execution for components; That is, it standardizes the way test runners are used. Other testing libraries used for utils, mocks, etc., are irrelevant, in that sense.

Standardization is done for component testing during development (in the workspace) as well as for distribution (in a capsule, as part of the component build pipeline).

Testing in development

Bit tests all components in the workspace using just a single command. That is true for components of all types, regardless of their specific Env, and as a consequence of that, regardless of their specific tester implementation.

bit test

Components can be watched for changes and retested with a single command, as well.

bit test -w

To learn more on testing during development, please refer to Workspace Testing.

Testing during build

Testing components for distribution is done during build by the Bit Builder.

Component build can be simulated with bit build and done through bit snap or bit tag.

bit build

By default, Bit's pre-configured Envs includes a Build Task for testing components in the Build Pipeline, each using the Env's specific test configs.

Testing during build provides the highest "external validity" by running tests on the distributable code that was generated by the Env's compiler and not by the tester's. That way, the exact same code that will be consumed by other components, is tested before it is released. Moreover, since each component is tested in a capsule , isolated from the rest of the workspace, tests are guaranteed to provide results that are context-agnostic and free of false-positives.

To learn more on testing during build, please refer to Testing During Build.

Configuring and implementing Testers

Testers are used and configured by the components' Env. See your env's documentation to learn how to use a different tester or to change the current tester config.