2018-09-20 03:36:56 +08:00
|
|
|
module.exports = {
|
2021-09-02 04:39:46 +08:00
|
|
|
testEnvironment: 'jsdom',
|
2018-09-20 03:36:56 +08:00
|
|
|
preset: 'ts-jest',
|
2020-07-28 10:58:37 +08:00
|
|
|
setupFilesAfterEnv: ['./scripts/setupJestEnv.ts'],
|
2018-09-20 05:45:19 +08:00
|
|
|
globals: {
|
|
|
|
__DEV__: true,
|
2019-11-05 00:24:22 +08:00
|
|
|
__TEST__: true,
|
2019-12-11 07:24:59 +08:00
|
|
|
__VERSION__: require('./package.json').version,
|
2019-09-17 23:57:25 +08:00
|
|
|
__BROWSER__: false,
|
2020-02-14 07:50:36 +08:00
|
|
|
__GLOBAL__: false,
|
2020-04-21 03:23:26 +08:00
|
|
|
__ESM_BUNDLER__: true,
|
|
|
|
__ESM_BROWSER__: false,
|
2020-01-29 22:49:17 +08:00
|
|
|
__NODE_JS__: true,
|
2020-07-21 09:51:30 +08:00
|
|
|
__FEATURE_OPTIONS_API__: true,
|
2020-10-08 09:46:25 +08:00
|
|
|
__FEATURE_SUSPENSE__: true,
|
2021-04-06 05:09:22 +08:00
|
|
|
__FEATURE_PROD_DEVTOOLS__: false,
|
2021-07-02 20:27:52 +08:00
|
|
|
__COMPAT__: true,
|
|
|
|
'ts-jest': {
|
|
|
|
tsconfig: {
|
2021-08-23 03:33:21 +08:00
|
|
|
target: 'esnext',
|
|
|
|
sourceMap: true
|
2021-07-02 20:27:52 +08:00
|
|
|
}
|
|
|
|
}
|
2018-09-20 05:45:19 +08:00
|
|
|
},
|
2018-09-20 03:36:56 +08:00
|
|
|
coverageDirectory: 'coverage',
|
|
|
|
coverageReporters: ['html', 'lcov', 'text'],
|
2019-10-11 10:02:20 +08:00
|
|
|
collectCoverageFrom: [
|
|
|
|
'packages/*/src/**/*.ts',
|
2019-12-11 22:46:52 +08:00
|
|
|
'!packages/runtime-test/src/utils/**',
|
2019-11-05 07:41:40 +08:00
|
|
|
'!packages/template-explorer/**',
|
2021-03-28 14:20:11 +08:00
|
|
|
'!packages/sfc-playground/**',
|
2020-04-02 09:36:50 +08:00
|
|
|
'!packages/size-check/**',
|
2020-06-12 04:58:11 +08:00
|
|
|
'!packages/runtime-core/src/profiling.ts',
|
2020-10-14 16:23:51 +08:00
|
|
|
'!packages/runtime-core/src/customFormatter.ts',
|
2020-06-12 04:58:11 +08:00
|
|
|
// DOM transitions are tested via e2e so no coverage is collected
|
|
|
|
'!packages/runtime-dom/src/components/Transition*',
|
|
|
|
// only called in browsers
|
|
|
|
'!packages/vue/src/devCheck.ts',
|
|
|
|
// only used as a build entry
|
2021-05-01 06:15:36 +08:00
|
|
|
'!packages/vue/src/runtime.ts',
|
|
|
|
// mostly just entries
|
|
|
|
'!packages/vue-compat/**'
|
2019-10-11 10:02:20 +08:00
|
|
|
],
|
2020-02-12 07:40:21 +08:00
|
|
|
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
|
2019-06-12 15:43:19 +08:00
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
2018-09-20 03:36:56 +08:00
|
|
|
moduleNameMapper: {
|
2021-09-21 22:48:32 +08:00
|
|
|
'@vue/consolidate': '@vue/consolidate',
|
2021-04-07 00:17:17 +08:00
|
|
|
'@vue/compat': '<rootDir>/packages/vue-compat/src',
|
2020-01-30 07:03:42 +08:00
|
|
|
'^@vue/(.*?)$': '<rootDir>/packages/$1/src',
|
2021-09-23 21:40:13 +08:00
|
|
|
'vue/compiler-sfc': '<rootDir>/packages/compiler-sfc/src',
|
|
|
|
'vue/server-renderer': '<rootDir>/packages/server-renderer/src',
|
2021-09-21 22:48:32 +08:00
|
|
|
vue: '<rootDir>/packages/vue/src'
|
2018-09-20 03:36:56 +08:00
|
|
|
},
|
|
|
|
rootDir: __dirname,
|
2019-12-23 23:51:28 +08:00
|
|
|
testMatch: ['<rootDir>/packages/**/__tests__/**/*spec.[jt]s?(x)'],
|
|
|
|
testPathIgnorePatterns: process.env.SKIP_E2E
|
|
|
|
? // ignore example tests on netlify builds since they don't contribute
|
|
|
|
// to coverage and can cause netlify builds to fail
|
|
|
|
['/node_modules/', '/examples/__tests__']
|
|
|
|
: ['/node_modules/']
|
2018-09-20 03:36:56 +08:00
|
|
|
}
|