-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcucumber.js
36 lines (32 loc) · 1.24 KB
/
cucumber.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
const fs = require('fs');
const FAIL_FAST = process.env.FAIL_FAST || '--fail-fast';
const NO_STRICT = process.env.NO_STRICT || '--no-strict';
function generateConfig(profile) {
fs.mkdirSync(`test-results/${profile}`, { recursive: true });
const RERUN = `@cucumber-${profile}.rerun`;
const FEATURE_GLOB =
fs.existsSync(RERUN) && fs.statSync(RERUN).size !== 0
? RERUN
: `test/resources/features/**/*.feature --tags 'not(@not-${profile})'`;
const FORMAT_OPTIONS = {
snippetInterface: 'async-await',
snippetSyntax:
'./node_modules/@windyroad/cucumber-js-throwables/lib/custom-cucumber-syntax.js',
};
const MODULES =
'--require-module @babel/register --require-module @babel/polyfill';
const REQUIRE_GLOB = 'test/js/**/*.js';
const BASE_CONFIG = `${FEATURE_GLOB} --format-options '${JSON.stringify(
FORMAT_OPTIONS,
)}' ${MODULES} --require ${REQUIRE_GLOB} ${NO_STRICT} --format rerun:${RERUN} --format json:test-results/${profile}/results.cucumber ${FAIL_FAST}`;
if (profile === 'system') {
return `${BASE_CONFIG} --world-parameters '${JSON.stringify({
client: 'rest',
})}'`;
}
return BASE_CONFIG;
}
module.exports = {
default: generateConfig('component'),
system: generateConfig('system'),
};