-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.js
40 lines (34 loc) · 1.02 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
33
34
35
36
37
38
39
40
/**
* Module dependencies
*/
const Nightwatch = require('nightwatch/lib/index.js');
const {Logger, shouldReplaceStack, alwaysDisplayError} = require('nightwatch/lib/utils');
try {
Nightwatch.cli(function(argv) {
argv._source = argv['_'].slice(0);
const runner = Nightwatch.CliRunner(argv);
require('ts-node').register();
return runner
.setupAsync()
.catch(err => {
if (err.code === 'ERR_REQUIRE_ESM') {
err.showTrace = false;
}
throw err;
})
.then(() => runner.runTests())
.catch((err) => {
if (!err.displayed || alwaysDisplayError(err) && !err.displayed) {
Logger.error(err);
}
runner.processListener.setExitCode(10).exit();
});
});
} catch (err) {
const {message} = err;
err.message = 'An error occurred while trying to start the Nightwatch Runner:';
err.showTrace = !shouldReplaceStack(err);
err.detailedErr = message;
Logger.error(err);
process.exit(2);
}