-
Notifications
You must be signed in to change notification settings - Fork 21
/
test.js
executable file
·53 lines (45 loc) · 1.64 KB
/
test.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env node
var Gagarin = require('./lib/mocha/gagarin');
var path = require('path');
var fs = require('fs');
var logs = require('./lib/logs');
var pathToApp = path.resolve('./tests/example');
var program = require('commander');
program
.option('-g, --grep <pattern>', 'only run tests matching <pattern>')
.option('-w, --webdriver <url>', 'webdriver url [default: http://127.0.0.1:9515]', 'http://127.0.0.1:9515')
.option('-B, --skip-build', 'do not build, just run the tests')
.option('-o, --build-only', 'just build, do not run the tests')
.option('-v, --verbose', 'run with verbose mode with logs from client/server', false)
.option('-p, --parallel <number>', 'run test suites in parallel', parseInt, 0)
.option('-m, --mute-build', 'do not show build logs', false)
program.parse(process.argv);
// set verbose mode ...
logs.setVerbose(program.verbose);
logs.setSilentBuild(program.muteBuild);
var gagarin = new Gagarin({
pathToApp : pathToApp,
webdriver : program.webdriver,
reporter : 'spec',
timeout : 10000,
muteBuild : program.muteBuild,
grep : program.grep,
skipBuild : program.skipBuild,
buildOnly : program.buildOnly,
parallel : program.parallel,
startupTimeout : 5000,
meteorLoadTimeout : 4000,
verbose : program.verbose,
});
fs.readdirSync(path.join(__dirname, 'tests', 'specs')).forEach(function (file) {
var fileType = path.extname(file);
if (fileType === '.js') {
gagarin.addFile(path.join(__dirname, 'tests', 'specs', file));
}
});
gagarin.run(function (failedCount) {
if (failedCount > 0) {
process.exit(1);
}
process.exit(0);
});