This repository was archived by the owner on Sep 21, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathtest.js
More file actions
42 lines (38 loc) · 1.29 KB
/
Copy pathtest.js
File metadata and controls
42 lines (38 loc) · 1.29 KB
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
'use strict';
var common = require('./common'),
Config = require('../config'),
Tester = require('../tester');
module.exports = function() {
this.title('Compare current state with previous')
.helpful()
.apply(common.testFiles)
.apply(common.configFile)
.opt()
.name('reporter')
.long('reporter').short('r')
.def('tree')
.val(function(value) {
try {
return require('../reporters/' + value);
} catch(e) {
if (e.code === 'MODULE_NOT_FOUND') {
throw 'No such reporter: ' + value;
}
throw e;
}
})
.end()
.act(function(opts, args) {
var reporter = opts.reporter;
return Config.read(opts.configFile)
.then(function(config) {
return [config, common.buildSuite(args.testFiles)];
})
.spread(function(config, suite) {
var tester = new Tester(config);
reporter(tester);
return tester.run(suite.children);
})
.fail(common.handleErrors);
});
};