UNPKG

jmd-scripts

Version:

CLI for common scripts for my projects

42 lines (36 loc) 1.12 kB
"use strict"; const path = require('path'); const { ifAnyDep, hasFile, hasPkgProp, fromRoot } = require('../utils'); const here = p => path.join(__dirname, p); const useBuiltInBabelConfig = !hasFile('.babelrc') && !hasPkgProp('babel'); const ignores = ['/node_modules/', '/fixtures/', '/__tests__/helpers/', '__mocks__']; const jestConfig = { roots: [fromRoot('src')], testEnvironment: ifAnyDep(['webpack', 'rollup', 'react'], 'jsdom', 'node'), testURL: 'http://localhost', moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'], collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'], testMatch: ['**/__tests__/**/*.+(js|jsx|ts|tsx)'], testPathIgnorePatterns: [...ignores], coveragePathIgnorePatterns: [...ignores, 'src/(umd|cjs|esm)-entry.js$'], transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'], coverageThreshold: { global: { branches: 100, functions: 100, lines: 100, statements: 100 } } }; if (useBuiltInBabelConfig) { jestConfig.transform = { '^.+\\.js$': here('./babel-transform') }; } module.exports = jestConfig;