问题描述
我添加了以下步骤以在 Azure 管道中为 React UI 运行单元测试。
添加了一个文件,文件名:jestTrxProcessor.js。内容:
var builder = require("jest-trx-results-processor/dist/testResultsProcessor");
var builder = require("jest-trx-results-processor");
var processor = builder({
outputFile: "jestTestresults.trx",});
module.exports = processor;
- 在 package.json 中,我输入了以下代码:
"scripts": {
....
"test": "jest"
},devdependencies{
...
"jest": "^23.4.1","jest-trx-results-processor": "0.0.7","jsdom": "^11.12.0"
},"jest": {
"testResultsProcessor": "./__tests__/jestTrxProcessor.js","reporters": [
"default",[
"jest-trx-results-processor",{
"outputFile": "./__tests__/jestTestresults.trx",}
]]},
3.在 yaml 文件中,我添加了以下脚本:
- script: |
npm install
npm install jest-trx-results-processor --save-dev
yarn add --dev jest-trx-results-processor
npm run build
# npm run test
displayName: 'npm install and build'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: './__tests__/jestTestresults.trx'
testRunTitle: 'FrontEnd Test'
我收到以下错误:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)