forked from cucumber/cucumber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.js
34 lines (29 loc) · 904 Bytes
/
step.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
import _ from 'lodash'
import {getStepKeywordType} from '../keyword_type'
import StepArguments from './step_arguments'
export default class Step {
constructor(options) {
const {
backgroundLines,
gherkinData,
language,
lineToKeywordMapping,
previousStep,
scenario
} = options
this.arguments = _.map(gherkinData.arguments, StepArguments.build)
this.line = _.last(_.map(gherkinData.locations, 'line'))
this.name = gherkinData.text
this.scenario = scenario
this.uri = scenario.uri
this.isBackground = _.some(gherkinData.locations, ({line}) => {
return _.includes(backgroundLines, line)
})
this.keyword = _.chain(gherkinData.locations)
.map(({line}) => lineToKeywordMapping[line])
.compact()
.first()
.value()
this.keywordType = getStepKeywordType({language, previousStep, step: this})
}
}