junit reporter added for CI
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-05-13 12:25:35 +02:00
parent 09a1dc62df
commit d4fab02252
2 changed files with 27 additions and 18 deletions

8
Jenkinsfile vendored
View File

@ -55,13 +55,13 @@ pipeline {
NODE_ENV = ""
}
parallel {
/* stage('Frontend') {
stage('Frontend') {
steps {
nodejs('node-v14') {
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2'
}
}
} */
}
stage('Backend') {
steps {
nodejs('node-v14') {
@ -121,8 +121,8 @@ pipeline {
script {
if (!['master', 'test'].contains(env.BRANCH_NAME)) {
try {
// junit 'junitresults.xml'
// junit 'junit.xml'
junit 'junitresults.xml'
junit 'junit.xml'
} catch (e) {
echo e.toString()
}

View File

@ -27,9 +27,30 @@ async function test() {
const app = require('vn-loopback/server/server');
app.boot(bootOptions);
const Jasmine = require('jasmine');
const jasmine = new Jasmine();
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
let reporter = new SpecReporter({
spec: {
displaySuccessful: isCI,
displayPending: isCI
},
summary: {
displayPending: false,
}
});
if (isCI) {
const reporters = require('jasmine-reporters');
reporter = new reporters.JUnitXmlReporter();
}
const Jasmine = require('jasmine');
const jasmine = new Jasmine({
reporter: [
reporter
]
});
if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
const backSpecs = [
'./back/**/*[sS]pec.js',
@ -43,18 +64,6 @@ async function test() {
helpers: [],
});
jasmine.addReporter(new SpecReporter({
spec: {
displaySuccessful: isCI,
displayPending: isCI
},
summary: {
displayPending: false,
}
}));
if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
jasmine.exitOnCompletion = false;
await jasmine.execute();
if (app) await app.disconnect();