-
-
Notifications
You must be signed in to change notification settings - Fork 719
/
run.js
34 lines (31 loc) · 1.02 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
'use strict';
let getConfig = require('./utils').getConfig;
let getTestRoot = require('./utils').getTestRoot;
let deepMerge = require('./utils').deepMerge;
let Codecept = require('../codecept');
let output = require('../output');
module.exports = function (suite, test, options) {
// registering options globally to use in config
process.profile = options.profile;
let configFile = options.config;
let codecept;
let testRoot = getTestRoot(suite);
let config = getConfig(testRoot, configFile);
// override config with options
if (options.override) {
config = deepMerge(config, JSON.parse(options.override));
}
try {
codecept = new Codecept(config, options);
codecept.init(testRoot, function (err) {
if (err) throw new Error('Error while running bootstrap file :' + err);
codecept.loadTests();
codecept.run(test);
});
} catch (err) {
output.print('');
output.error(err.message);
output.print('');
output.print(output.colors.grey(err.stack.replace(err.message, '')));
}
};