-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.js
32 lines (31 loc) · 1.23 KB
/
runner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var exec = require('child_process').exec,
queryString = require('querystring'),
args = queryString.parse(process.argv.splice(2).join('&')),
testModules = require('./tests/testModules')(args.functionalTest),
cmd = 'cd node_modules/intern-ui && ',
tests = {},
environments;
try {
// Try to grab the outer-level environments.json
environments = require('../tests/environments.json');
} catch (e) {
// Default to local environments.json if not found
environments = require('./tests/environments.json');
}
if (args.site in testModules && args.browser in environments) {
cmd += 'grunt test --site=' + args.site
+ ' --browser=' + args.browser
+ ' --functionalTest=' + args.functionalTest;
} else if (args.site in testModules && args.browser === 'all') {
cmd += 'grunt testAllBrowsers --site=' + args.site + ' --functionalTest=' + args.functionalTest;
} else {
console.log('Error: No tests selected');
return;
}
exec(cmd, function(error, stdout) {
if (stdout) {
console.log(stdout.replace(/\[\d*m/g, '').replace(new RegExp('^.*' + environments[args.browser].browserName + '\n', 'm'), ''));
} else {
console.log(JSON.stringify({ error: 'Script did not finish.' }));
}
});