forked from Tencent/tdesign-miniprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.virtualHost.config.js
37 lines (36 loc) · 1.27 KB
/
jest.virtualHost.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* virtualHost 的开启和关闭对 dom 渲染会产生较大差异,且在单测中无法通过 selectComponent 获取子组件实例,
* 故设置两个 jest 配置文件,区分 virtualHost 的两种状态。
*/
module.exports = {
verbose: true,
testEnvironment: 'jsdom',
testURL: 'http://localhost/',
moduleFileExtensions: ['js', 'ts'],
moduleNameMapper: {
'^tdesign-miniprogram/(.*)': '<rootDir>/src/$1',
},
testMatch: ['<rootDir>/src/**/__test__/**/*.test.{js,ts}'],
collectCoverageFrom: ['<rootDir>/src/**/*.{js,ts}', '!**/__test__/**', '!**/_example/**'],
collectCoverage: true,
coverageProvider: 'v8',
coverageDirectory: '<rootDir>/test/unit-virtualHost/coverage',
reporters: [
'default',
[
'./node_modules/jest-html-reporter',
{
pageTitle: 'TDesign-miniprogram Unit Test Report(virtualHost)',
outputPath: './test/unit-virtualHost/report/test-report.html',
},
],
],
setupFiles: ['<rootDir>/script/test/virtualHostSetup.js'],
coverageReporters: ['html', 'json-summary'],
globals: {
CONFIG_PREFIX: 't',
},
globalSetup: '<rootDir>/script/test/globalSetup.js',
snapshotSerializers: ['miniprogram-simulate/jest-snapshot-plugin'],
snapshotResolver: '<rootDir>/script/test/snapshotResolver.js',
};