Skip to content

Instantly share code, notes, and snippets.

@wldcordeiro
Created May 25, 2018 02:44
Show Gist options
  • Save wldcordeiro/6dc2eb97a26a52d548ed4aa86f2fc5c0 to your computer and use it in GitHub Desktop.
Save wldcordeiro/6dc2eb97a26a52d548ed4aa86f2fc5c0 to your computer and use it in GitHub Desktop.
Jest Multi Project Example
const { resolve } = require('path')
const root = resolve(__dirname, '..')
module.exports = {
rootDir: root,
displayName: 'eslint',
runner: 'jest-runner-eslint',
testMatch: ['<rootDir>/src/**/*.js', '<rootDir>/config/*.js'],
}
module.exports = {
projects: [
'<rootDir>/jest-eslint.config.js',
'<rootDir>/jest-prettier.config.js',
],
}
const { resolve } = require('path')
const root = resolve(__dirname, '..')
module.exports = {
rootDir: root,
displayName: 'prettier',
runner: 'jest-runner-write-prettier',
testMatch: ['<rootDir>/src/**/*.js', '<rootDir>/config/*.js', '*.js'],
moduleFileExtensions: ['js'],
}
const { resolve } = require('path')
const root = resolve(__dirname, '..')
module.exports = {
rootDir: root,
displayName: 'test',
testPathIgnorePatterns: ['/node_modules/', '/cypress/'],
collectCoverageFrom: [
'src/**/*.js',
'!src/index.js',
'!**/fixtures/**/*.js',
'!**/**/test-setup.js',
'!**/**/*.spec.js',
'!**/**/*.mock.js',
'!**/**/*.test.js',
],
coverageThreshold: {
global: {
statements: 90,
branches: 75,
functions: 85,
lines: 90,
},
},
setupTestFrameworkScriptFile: '<rootDir>/jest-setup.js',
testEnvironment: 'jest-environment-jsdom-global',
transform: {
'^.+\\.jsx?$': 'babel-jest',
'.*': '@brimstone/jest-static-assets-mocker',
},
snapshotSerializers: [
'jest-glamor-react',
'enzyme-to-json/serializer',
'snapshot-diff-serializer',
],
transformIgnorePatterns: [
'node_modules/(?!(css-wipe|@wf-titan/kashyyyk-theme|@inferno/effigy))',
],
testURL: 'https://example.com/',
}
module.exports = {
projects: [
'<rootDir>/jest-test.config.js',
'<rootDir>/jest-eslint.config.js',
'<rootDir>/jest-prettier.config.js',
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment