Basic jest configs for typescript monorepo.
-
npm
npm install --save-dev @guanghechen/jest-config
-
yarn
yarn add --dev @guanghechen/jest-config
-
Use in jest.config.js
const { tsMonorepoConfig } = require('@guanghechen/jest-config') module.exports = async function () { const baseConfig = await tsMonorepoConfig(__dirname, { useESM: true }) return { ...baseConfig, coverageThreshold: { global: { branches: 100, functions: 100, lines: 100, statements: 100, }, }, } }
-
Use in jest.config.mjs
import { tsMonorepoConfig } from '@guanghechen/jest-config' import path from 'node:path' import url from 'node:url' export default async function () { const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) const baseConfig = await tsMonorepoConfig(__dirname, { useESM: true }) return { ...baseConfig, coverageThreshold: { global: { branches: 100, functions: 100, lines: 100, statements: 100, }, }, } }