-
Notifications
You must be signed in to change notification settings - Fork 0
/
customFormat.js
26 lines (26 loc) · 1.01 KB
/
customFormat.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
const { SummaryFormatter, formatterHelpers, Status } = require('@cucumber/cucumber')
class SimpleFormatter extends SummaryFormatter {
constructor(options) {
super(options)
options.eventBroadcaster.on('envelope', (envelope) => {
if (envelope.testCaseFinished) {
this.logTestCaseFinished(envelope.testCaseFinished)
}
})
}
logTestCaseFinished(testCaseFinished) {
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId)
this.log(testCaseAttempt.gherkinDocument.feature.name + ' / ' + testCaseAttempt.pickle.name + '\n')
const parsed = formatterHelpers.parseTestCaseAttempt({
cwd: this.cwd,
snippetBuilder: this.snippetBuilder,
supportCodeLibrary: this.supportCodeLibrary,
testCaseAttempt
})
parsed.testSteps.forEach(testStep => {
this.log(' ' + testStep.keyword + (testStep.text || '') + ' - ' + Status[testStep.result.status] + '\n')
})
this.log('\n')
}
}
module.exports = SimpleFormatter