问题描述
我找到了一些针对版本的关于SO的问题以供开玩笑的单元测试在VSTS构建测试结果"选项卡中发布其结果.但是找不到适当的解决方案.
I've found some questions on SO specific to version for jest unit test to publish its result in VSTS build Test Results tab. But no proper solution is found.
推荐答案
我已经扔了一些有趣的npm软件包,例如 tap-xunit
和jest-json-to-tap
,但无法确定它是否有效.以下步骤对我有用,以使结果可在测试VSTS 版本.
I've gone throw some jest npm packages like tap-xunit
and jest-json-to-tap
but couldn't figure out it to work. Following steps worked for me to get the results to review under Test of VSTS build.
# NPM
npm install jest-trx-results-processor --save-dev
# Yarn
yarn add -D jest-trx-results-processor
创建具有以下内容的jestTrxProcessor.js
文件:
var builder = require('jest-trx-results-processor');
var processor = builder({
outputFile: 'jestTestresults.trx'
});
module.exports = processor;
更新的package.json
文件应如下所示:
Updated package.json
file should look like:
"devDependencies": {
"jest": "^23.4.1",
"jest-trx-results-processor": "0.0.7",
"jsdom": "^11.12.0",
...
},
"scripts": {
"test": "jest"
},
"jest": {
...,
"testResultsProcessor": "./jestTrxProcessor.js"
}
添加npm
npm test
的VSTS构建任务.这将运行笑话测试并将结果发布到jestTestresults.trx
Add npm
task to VSTS build for npm test
. This will run jest tests and publish results to jestTestresults.trx
您将能够看到JEST测试以及其他测试.
You will be able to see JEST tests along with other tests.
这篇关于如何在VSTS测试中发布Jest单元测试结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!