-
-
Notifications
You must be signed in to change notification settings - Fork 737
/
Copy pathrun.js
44 lines (36 loc) · 1.05 KB
/
run.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
const {
getConfig, printError, getTestRoot, createOutputDir,
} = require('./utils');
const Config = require('../config');
const Codecept = require('../codecept');
module.exports = async function (test, options) {
// registering options globally to use in config
// Backward compatibility for --profile
process.profile = options.profile;
if (options.profile) {
process.env.profile = options.profile;
}
const configFile = options.config;
let config = getConfig(configFile);
if (options.override) {
config = Config.append(JSON.parse(options.override));
}
const testRoot = getTestRoot(configFile);
createOutputDir(config, testRoot);
const codecept = new Codecept(config, options);
try {
codecept.init(testRoot);
await codecept.bootstrap();
codecept.loadTests(test);
if (options.verbose) {
const getInfo = require('./info');
await getInfo(testRoot, options);
}
await codecept.run();
} catch (err) {
printError(err);
process.exitCode = 1;
} finally {
await codecept.teardown();
}
};