-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcucumber.js
73 lines (69 loc) · 2.25 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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`
let TAGS = process.env.ADDRESSR_ENABLE_GEO
? `--tags 'not(@not-${profile}) and not(@not-geo)`
: `--tags 'not(@not-${profile}) and not(@geo)`
if (profile === 'rest2') {
TAGS = `${TAGS} and @rest2`
}
if (profile === 'cli2') {
TAGS = `${TAGS} and @rest2`
}
TAGS = `${TAGS}'`
const NON_RERUN_GLOB = `test/resources/features/**/*.feature ${TAGS}`
const FEATURE_GLOB =
fs.existsSync(RERUN) && fs.statSync(RERUN).size !== 0
? RERUN
: NON_RERUN_GLOB
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 === 'rest') {
const rval = `${BASE_CONFIG} --world-parameters '${JSON.stringify({
client: 'rest'
})}'`
console.log('BASE_CONFIG - rest', rval)
return rval
}
if (profile === 'rest2') {
const rval = `${BASE_CONFIG} --world-parameters '${JSON.stringify({
client: 'rest2'
})}'`
console.log('BASE_CONFIG - rest2', rval)
return rval
}
if (profile === 'cli') {
const rval = `${BASE_CONFIG} --world-parameters '${JSON.stringify({
client: 'rest',
starter: 'cli'
})}'`
console.log('BASE_CONFIG - cli', rval)
return rval
}
if (profile === 'cli2') {
const rval = BASE_CONFIG
console.log('BASE_CONFIG - cli2', rval)
return rval
}
console.log('BASE_CONFIG', BASE_CONFIG)
return BASE_CONFIG
}
module.exports = {
default: generateConfig('nodejs'),
rest: generateConfig('rest'),
rest2: generateConfig('rest2'),
cli: generateConfig('cli'),
cli2: generateConfig('cli2')
}