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 (the tester task lists the compiler task as its dependency, to make sure it always runs after the compilation is done). 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.

When snapping a component, test results are stored as part of the component metadata, and are easily accessible in the component UI.