如何覆盖默认输出目录和文件名jest-junit?
我想在使用 Jest 时自定义输出的输出配置,但它仍然在默认位置结束,即./junit.xml
在项目根文件夹中。
我的配置
在package.json中:
"scripts": {
"test": "jest --ci --reporters=default --reporters=jest-junit"
},
"devDependencies": {
"jest": "^24.9.0",
"jest-junit": "^10.0.0",
}
在jest.config.js 中
module.exports = {
testMatch: [
'**/*.spec.js',
],
reporters: [
'default',
[ 'jest-junit', {
outputDirectory: 'test_reports',
outputName: 'jest-junit.xml',
} ]
]
};
预期结果:
- 包含测试结果的文件
./test_reports/jest-junit.xml
实际结果:
- 默认为测试结果的文件
./junit.xml