Skip to content

Latest commit

 

History

History

jest-config

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Basic jest configs for typescript monorepo.

Install

  • npm

    npm install --save-dev @guanghechen/jest-config
  • yarn

    yarn add --dev @guanghechen/jest-config

Usage

  • 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,
          },
        },
      }
    }

Related