Skip to content

Commit

Permalink
fix(karma): ensure job number reflects CI environment
Browse files Browse the repository at this point in the history
Fixes #111
  • Loading branch information
keithamus committed Nov 7, 2017
1 parent 49b7062 commit 94941f3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
const packageJson = require('./package.json');
/* eslint-disable no-process-env */
let job = process.env.JOB_NUMBER || Date.now();
let browsers = [ 'ChromeHeadless' ];
let build = 'localbuild';
let branch = 'local';
let job = Date.now();
let startConnect = false;
const reporters = [ 'progress', 'coverage' ];
const tags = [ `${ packageJson.name }@${ packageJson.version }` ];
const frameworks = [ 'mocha' ];

/* eslint-disable no-process-env */
const debug = Boolean(process.env.npm_config_debug);
if (process.env.SAUCE_ACCESS_KEY && process.env.SAUCE_USERNAME) {
browsers = [ 'SauceEdgeLatest', 'SauceInternetExplorerTen', 'SauceSafariLatest' ];
tags.push(`${ process.env.SAUCE_USERNAME }@${ branch }`);
reporters.push('saucelabs');
startConnect = true;
} else if (process.env.APPVEYOR) {
browsers = [ 'Firefox', 'ChromeHeadless', 'IE' ];
branch = process.env.APPVEYOR_REPO_BRANCH;
job = process.env.APPVEYOR_JOB_NUMBER;
build = `appveyor@${ process.env.APPVEYOR_JOB_NUMBER }`;
} else if (process.env.TRAVIS) {
browsers = [ 'FirefoxHeadless', 'ChromeHeadless' ];
branch = process.env.TRAVIS_BRANCH;
job = process.env.TRAVIS_JOB_NUMBER;
build = `travis@${ process.env.TRAVIS_JOB_NUMBER }`;
startConnect = true;
} else if (!process.env.KARMA_MANUAL) {
browsers = [];
frameworks.push('detectBrowsers');
}

if (process.env.APPVEYOR) {
branch = process.env.APPVEYOR_REPO_BRANCH;
build = `appveyor@${ process.env.APPVEYOR_JOB_NUMBER }`;
job = process.env.APPVEYOR_JOB_NUMBER;
} else if (process.env.TRAVIS) {
branch = process.env.TRAVIS_BRANCH;
build = `travis@${ process.env.TRAVIS_JOB_NUMBER }`;
job = process.env.TRAVIS_JOB_NUMBER;
}
/* eslint-enable */

tags.push(build);
Expand Down

0 comments on commit 94941f3

Please sign in to comment.