Skip to content

Commit 9ba473d

Browse files
committed
run test-bundle in series
- to improve log readability - to keep cpu levels somewhat constant throughout run
1 parent 89d7aa8 commit 9ba473d

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

tasks/test_bundle.js

+37-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
var path = require('path');
2+
var exec = require('child_process').exec;
23
var glob = require('glob');
4+
var runSeries = require('run-series');
35

46
var constants = require('./util/constants');
5-
var common = require('./util/common');
6-
var pathToJasmineBundleTests = path.join(constants.pathToJasmineBundleTests);
7-
7+
var pathToJasmineBundleTests = constants.pathToJasmineBundleTests;
88

9+
/**
10+
* Run all jasmine 'bundle' test in series
11+
*
12+
* To run specific bundle tests, use
13+
*
14+
* $ npm run test-jasmine -- --bundleTest=<name-of-suite>
15+
*/
916
glob(pathToJasmineBundleTests + '/*.js', function(err, files) {
10-
files.forEach(function(file) {
11-
var baseName = path.basename(file);
12-
var cmd = 'npm run test-jasmine -- --bundleTest=' + baseName;
17+
var tasks = files.map(function(file) {
18+
return function(cb) {
19+
var cmd = [
20+
'karma', 'start',
21+
path.join(constants.pathToRoot, 'test', 'jasmine', 'karma.conf.js'),
22+
'--bundleTest=' + path.basename(file),
23+
'--nowatch'
24+
].join(' ');
25+
26+
console.log('Running: ' + cmd);
27+
28+
exec(cmd, function(err) {
29+
cb(null, err);
30+
}).stdout.pipe(process.stdout);
31+
};
32+
});
33+
34+
runSeries(tasks, function(err, results) {
35+
if(err) throw err;
36+
37+
var failed = results.filter(function(r) { return r; });
1338

14-
common.execCmd(cmd);
39+
if(failed.length) {
40+
console.log('\ntest-bundle summary:');
41+
failed.forEach(function(r) { console.warn('- ' + r.cmd + ' failed'); });
42+
console.log('');
43+
process.exit(1);
44+
}
1545
});
1646
});

0 commit comments

Comments
 (0)