diff --git a/Jenkinsfile b/Jenkinsfile index b295edffe..65526f926 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,12 +58,12 @@ pipeline { stage('Test') { environment { NODE_ENV = "" - FIREFOX_BIN = "firefox/firefox-bin" + FIREFOX_BIN = "/opt/firefox/firefox-bin" } steps { nodejs('node-lts') { - sh 'karma start' - sh 'gulp docker' + sh 'karma start --junit' + sh 'gulp docker --run-chown' sh 'gulp backendUnitTest --junit' sh 'docker rm -f salix-db' } diff --git a/gulpfile.js b/gulpfile.js index 2444baef1..7deb6baff 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -300,6 +300,8 @@ async function docker() { await execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./services/db`); let runChown = process.platform != 'linux'; + if (argv.runChown) runChown = true; + await execP(`docker run --env RUN_CHOWN=${runChown} -d --name salix-db -p 3306:3306 salix-db`); if (runChown) await dockerWait(); } diff --git a/karma.conf.js b/karma.conf.js index addf1dc55..4d9fdd2be 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -79,6 +79,7 @@ module.exports = function(config) { 'karma-webpack', 'karma-chrome-launcher', 'karma-firefox-launcher', + 'karma-junit-reporter', 'karma-sourcemap-loader' ], @@ -113,5 +114,15 @@ module.exports = function(config) { if (process.env.FIREFOX_BIN) baseConfig.browsers = ['FirefoxHeadless']; + if (config.junit) { + Object.assign(baseConfig, { + singleRun: true, + reporters: ['dots', 'junit'], + junitReporter: { + outputFile: 'test-results.xml' + } + }); + } + config.set(baseConfig); }; diff --git a/package-lock.json b/package-lock.json index eaa5ad342..c0321441c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8150,6 +8150,24 @@ } } }, + "karma-junit-reporter": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz", + "integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=", + "dev": true, + "requires": { + "path-is-absolute": "^1.0.0", + "xmlbuilder": "8.2.2" + }, + "dependencies": { + "xmlbuilder": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz", + "integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=", + "dev": true + } + } + }, "karma-sourcemap-loader": { "version": "0.3.7", "resolved": "https://registry.npmjs.org/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.7.tgz", diff --git a/package.json b/package.json index 118a93b50..be205472c 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "karma-chrome-launcher": "^2.2.0", "karma-firefox-launcher": "^1.1.0", "karma-jasmine": "^2.0.1", + "karma-junit-reporter": "^1.2.0", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^3.0.5", "merge-stream": "^1.0.1",