Allow configuration of the test reporter

The reporter for the standard tests is still 'spec'; the one for the
gathering of code coverage is set to 'dot' to not clutter the output
of the logfile on travis.
This commit is contained in:
Marc Jansen
2016-03-08 10:21:17 +01:00
parent 951b400227
commit 8c487d3036
2 changed files with 7 additions and 5 deletions

View File

@@ -164,7 +164,7 @@ var foundAllJavaScriptSourceFiles = function(err, files) {
wrench.copyDirSyncRecursive(instrumentedDir, dir, copyOpts); wrench.copyDirSyncRecursive(instrumentedDir, dir, copyOpts);
log('• run test suite on instrumented code'); log('• run test suite on instrumented code');
runTestsuite(true, collectAndWriteCoverageData); runTestsuite({coverage: true, reporter: 'dot'}, collectAndWriteCoverageData);
}; };
/** /**

View File

@@ -40,7 +40,9 @@ function listen(min, max, server, callback) {
} }
function runTests(includeCoverage, callback) { function runTests(conf, callback) {
var coverage = 'coverage' in conf ? conf.coverage : false;
var reporter = 'reporter' in conf ? conf.reporter : 'spec';
/** /**
* Create the debug server and run tests. * Create the debug server and run tests.
*/ */
@@ -60,14 +62,14 @@ function runTests(includeCoverage, callback) {
var args = [ var args = [
require.resolve('mocha-phantomjs-core'), require.resolve('mocha-phantomjs-core'),
url + '/test/index.html', url + '/test/index.html',
'spec' reporter
]; ];
var config = { var config = {
ignoreResourceErrors: true, ignoreResourceErrors: true,
useColors: true useColors: true
}; };
if (includeCoverage) { if (coverage) {
config.hooks = path.join(__dirname, '../test/phantom_hooks.js'); config.hooks = path.join(__dirname, '../test/phantom_hooks.js');
} }
@@ -82,7 +84,7 @@ function runTests(includeCoverage, callback) {
} }
if (require.main === module) { if (require.main === module) {
runTests(false, function(code) { runTests({coverage: false, reporter: 'spec'}, function(code) {
process.exit(code); process.exit(code);
}); });
} }