A modern Jest preset that provides code coverage and performance out of the box.
yarn add --dev jest-preset-moonAdd the preset to your root jest.config.js.
module.exports = {
preset: 'jest-preset-moon',
};- Configured for Node.js environments by default.
- Defines an empty file mock for non-JS/TS files (like CSS).
- Requires 90% code coverage of all source files.
- Improved performance through the Jest Circus runner.
- Supports
__DEV__,__PROD__, and__TEST__globals.
- Source files must be located in a
srcfolder. - Tests files must end in
*.test.*and be located within atestsor__tests__folder. - Includes a setup file at
<rootDir>/tests/setup.ts(if exists). - Relies on Babel, the TypeScript plugin, and the default
babel-jestpackage.