Skip to content

Commit

Permalink
run single test; coverage; support karma.conf.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
segrey committed Jul 3, 2017
1 parent cf524e4 commit 285b019
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 220 deletions.
33 changes: 18 additions & 15 deletions lib/intellij.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,30 @@ function configureDebug(config) {
config.browserNoActivityTimeout = null;
config.browsers = intellijUtil.isString(config.browserForDebugging) ? [config.browserForDebugging] : [];
console.error('intellij: config.browsers = ' + JSON.stringify(config.browsers));
fixMochaTimeout(config);
}

function fixMochaTimeout(config) {
var client = config.client;
if (typeof client === 'undefined') {
config.client = client = {};
}
if (client === Object(client)) {
var mocha = client.mocha;
if (typeof mocha === 'undefined') {
client.mocha = mocha = {};
(function fixMochaTimeout() {
var client = config.client;
if (typeof client === 'undefined') {
config.client = client = {};
}
if (mocha === Object(mocha)) {
mocha.timeout = 0;
if (client === Object(client)) {
var mocha = client.mocha;
if (typeof mocha === 'undefined') {
client.mocha = mocha = {};
}
if (mocha === Object(mocha)) {
mocha.timeout = 0;
}
}
}
})();
}

module.exports = function (config) {
IntellijCoverageReporter.preconfigureCoverage(config);
var originalConfigModule = require(originalConfigPath);
// https://github.com/karma-runner/karma/blob/v1.7.0/lib/config.js#L364
if (typeof originalConfigModule === 'object' && typeof originalConfigModule.default !== 'undefined') {
originalConfigModule = originalConfigModule.default;
}
originalConfigModule(config);

var reporters = config.reporters;
Expand Down
8 changes: 7 additions & 1 deletion lib/intellijCli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var SERVER_PORT_KEY = 'serverPort'
, DEBUG_KEY = 'debug'
, URL_ROOT_KEY = 'urlRoot'
, BROWSERS_KEY = 'browsers'
, COVERAGE_TEMP_DIR = 'coverageTempDir';
, COVERAGE_TEMP_DIR = 'coverageTempDir'
, TEST_NAME = 'testName';

function parseArguments() {
var argv = process.argv
Expand Down Expand Up @@ -91,6 +92,10 @@ function isWithCoverage() {
return options.hasOwnProperty(COVERAGE_TEMP_DIR);
}

function getTestName() {
return options[TEST_NAME];
}

exports.getKarmaFilePath = getKarmaFilePath;
exports.requireKarmaModule = requireKarmaModule;
exports.getConfigFile = getConfigFile;
Expand All @@ -100,3 +105,4 @@ exports.getUrlRoot = getUrlRoot;
exports.getBrowsers = getBrowsers;
exports.getCoverageTempDirPath = getCoverageTempDirPath;
exports.isWithCoverage = isWithCoverage;
exports.getTestName = getTestName;
Loading

0 comments on commit 285b019

Please sign in to comment.