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

View File

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