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.
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.
Install jest-trx-results-processor
# NPM
npm install jest-trx-results-processor --save-dev
# Yarn
yarn add -D jest-trx-results-processor
Create jestTrxProcessor.js
file with following content:
var builder = require('jest-trx-results-processor');
var processor = builder({
outputFile: 'jestTestresults.trx'
});
module.exports = processor;
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"
}
Add npm
task to VSTS build for npm test
. This will run jest tests and publish results to jestTestresults.trx
Publish Test Results
task of VSTS to add jestTestresults.trx
results in VSTS test.You will be able to see JEST tests along with other tests.