2019-10-11 07:35:10 +00:00
|
|
|
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-10-17 21:28:25 +00:00
|
|
|
|
2018-07-24 10:12:46 +00:00
|
|
|
expand: true,
|
2018-10-17 21:28:25 +00:00
|
|
|
|
|
|
|
forceExit: true,
|
|
|
|
|
2019-08-25 14:43:18 +00:00
|
|
|
roots: [
|
|
|
|
'<rootDir>/packages',
|
|
|
|
'<rootDir>/test'
|
|
|
|
],
|
|
|
|
|
2018-07-24 10:37:56 +00:00
|
|
|
// https://github.com/facebook/jest/pull/6747 fix warning here
|
2018-08-10 15:55:39 +00:00
|
|
|
// But its performance overhead is pretty bad (30+%).
|
|
|
|
// detectOpenHandles: true
|
2018-10-17 21:28:25 +00:00
|
|
|
|
2020-07-16 15:10:54 +00:00
|
|
|
setupFilesAfterEnv: ['./test/utils/setup-env'],
|
|
|
|
setupFiles: ['./test/utils/setup'],
|
2018-10-17 21:28:25 +00:00
|
|
|
|
|
|
|
coverageDirectory: './coverage',
|
|
|
|
|
|
|
|
collectCoverageFrom: [
|
2018-10-30 20:42:53 +00:00
|
|
|
'**/packages/*/src/**/*.js'
|
2018-10-17 21:28:25 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
coveragePathIgnorePatterns: [
|
2018-10-30 20:42:53 +00:00
|
|
|
'node_modules/(?!(@nuxt|nuxt))',
|
2019-03-04 20:12:33 +00:00
|
|
|
'packages/webpack/src/config/plugins/vue',
|
|
|
|
'packages/server/src/jsdom'
|
2018-10-17 21:28:25 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
testPathIgnorePatterns: [
|
2018-10-30 20:42:53 +00:00
|
|
|
'node_modules/(?!(@nuxt|nuxt))',
|
2018-10-17 21:28:25 +00:00
|
|
|
'test/fixtures/.*/.*?/',
|
|
|
|
'examples/.*'
|
|
|
|
],
|
|
|
|
|
2018-10-30 20:42:53 +00:00
|
|
|
transformIgnorePatterns: [
|
2023-02-01 15:48:53 +00:00
|
|
|
'node_modules/(?!(@nuxt|@sindresorhus|@szmarczak|nuxt|devalue|got|p-cancelable|cacheable-request|normalize-url|responselike|lowercase-keys|mimic-response|form-data-encoder|cacheable-lookup|get-port))',
|
2021-02-07 23:08:13 +00:00
|
|
|
'packages/utils/test/serialize\\.test\\.input\\.js'
|
2018-10-30 20:42:53 +00:00
|
|
|
],
|
|
|
|
|
2018-10-29 15:48:40 +00:00
|
|
|
transform: {
|
2023-02-01 13:41:09 +00:00
|
|
|
'^.+\\.[cm]?[jt]sx?$': 'babel-jest',
|
2022-06-23 22:58:52 +00:00
|
|
|
'^.+\\.vue$': '@vue/vue2-jest'
|
2018-10-29 15:48:40 +00:00
|
|
|
},
|
|
|
|
|
2018-10-17 21:28:25 +00:00
|
|
|
moduleFileExtensions: [
|
|
|
|
'js',
|
|
|
|
'json'
|
2019-05-25 14:17:21 +00:00
|
|
|
],
|
|
|
|
|
2019-10-11 07:35:10 +00:00
|
|
|
moduleNameMapper: {
|
2023-04-26 09:07:19 +00:00
|
|
|
[`consola$`]: '<rootDir>/node_modules/consola/dist/index.basic.cjs',
|
2019-10-11 07:35:10 +00:00
|
|
|
[`@nuxt/(${corePackages.join('|')})(/?.*)$`]: '<rootDir>/packages/$1/src/$2'
|
2020-01-19 10:23:59 +00:00
|
|
|
}
|
2018-03-18 23:41:14 +00:00
|
|
|
}
|