Jest is used to run tests by ts-engine.
By default all files matching
src/.*.test.(js|jsx|ts|tsx)$ are treated as test files.
To run all tests run the following command:
Configuring Jest via config file
You can extend and even overwrite the minimal Jest config that ts-engine provides out the box by using a
jest.config.js file. If it exists then it will be loaded and merged with ts-engine's Jest configuration, with values in
jest.config.js taking precendence.
For example, to enforce test coverage thresholds you can add the following
jest.config.js file to your package root directory:
ts-engine provides it's own
transform property to the Jest config internally. Overwriting this may affect your compilation when running tests.
You can provide a test setup file by creating a file called
jest.setup.ts. This will be provided to Jest via the
setupFilesAfterEnv config property without the need for you to configure it. This means you can have a setup file without a config file.
You can test codebases with React and JSX in them.
To support React run the following command:
Configuring Jest via CLI
All Jest CLI options are forwarded onto Jest with the exception of
--config. This means you can easily provide options such as
To run all tests in watch mode run the following command:
Custom Jest config support is planned for a future release.