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:
@@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user