diff --git a/Jenkinsfile b/Jenkinsfile index f1ab01af9..4a1f9ba54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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() } diff --git a/back/tests.js b/back/tests.js index 9b40ea728..d2a721c97 100644 --- a/back/tests.js +++ b/back/tests.js @@ -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();