-
Notifications
You must be signed in to change notification settings - Fork 10
/
performSetup.js
44 lines (37 loc) · 1.6 KB
/
performSetup.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
'use strict';
var fs_extra = require('fs-extra');
var featureFileSplitter = require('./featureFileSplitter');
var tmpFeatureFiles = new featureFileSplitter();
var emoji = require('node-emoji');
var chalk = require('chalk');
/**
* Compile and create splitted files
* @param {string} options.sourceSpecDirectory - glob expression for sourceSpecDirectory
* @param {string} options.tmpSpecDirectory - Path to temp folder containing the Temporary Feature Files
* @param {string} [options.tagExpression] - Tag expression to parse
* @param {string} [options.ff] - Feature File Name to parse
* @param {string} [options.lang] - Language of sourceSpecDirectory
* @param {Boolean} [options.cleanTmpSpecDirectory] - Boolean for cleaning the Temp Spec Directory
* @return {Promise<void>}
*/
var performSetup = function performSetup(options) {
try {
chalk.green.bold(emoji.emojify(':rocket:') + ' wdio-cucumber-parallel-execution triggered ') + emoji.emojify(':thumbsup:')
if (options.cleanTmpSpecDirectory) {
//Remove Tmp Spec Directory during setup & Create One
fs_extra.removeSync(options.tmpSpecDirectory);
}
fs_extra.ensureDirSync(options.tmpSpecDirectory);
//Compile and Create Split Feature Files
tmpFeatureFiles.compile({
sourceSpecDirectory: options.sourceSpecDirectory,
tmpSpecDirectory: options.tmpSpecDirectory,
tagExpression: options.tagExpression,
ff: options.ff,
lang: options.lang
});
} catch (e) {
console.log('Error: ', e);
}
};
module.exports = performSetup;