Nuxt/jest.config.js

65 lines
1.2 KiB
JavaScript
Raw Normal View History

const fs = require('fs')
const path = require('path')
const corePackages = fs.readdirSync(path.resolve(__dirname, 'packages'))
2018-03-18 23:41:14 +00:00
module.exports = {
2018-03-19 15:49:16 +00:00
testEnvironment: 'node',
2018-07-24 10:12:46 +00:00
expand: true,
forceExit: true,
roots: [
'<rootDir>/packages',
'<rootDir>/test'
],
// https://github.com/facebook/jest/pull/6747 fix warning here
// But its performance overhead is pretty bad (30+%).
// detectOpenHandles: true
2019-02-12 13:05:37 +00:00
setupFilesAfterEnv: ['./test/utils/setup'],
coverageDirectory: './coverage',
collectCoverageFrom: [
'**/packages/*/src/**/*.js'
],
coveragePathIgnorePatterns: [
'node_modules/(?!(@nuxt|nuxt))',
'packages/webpack/src/config/plugins/vue',
'packages/server/src/jsdom'
],
testPathIgnorePatterns: [
'node_modules/(?!(@nuxt|nuxt))',
'test/fixtures/.*/.*?/',
'examples/.*'
],
transformIgnorePatterns: [
'node_modules/(?!(@nuxt|nuxt))'
],
transform: {
'^.+\\.js$': 'babel-jest',
2019-02-12 13:05:37 +00:00
'^.+\\.vue$': 'vue-jest'
},
moduleFileExtensions: [
'js',
'json'
],
moduleNameMapper: {
[`@nuxt/(${corePackages.join('|')})(/?.*)$`]: '<rootDir>/packages/$1/src/$2'
},
reporters: [
'default',
['jest-junit', { outputDirectory: 'reports/junit' }]
2019-02-12 13:05:37 +00:00
]
2018-03-18 23:41:14 +00:00
}