Skip to content

Commit

Permalink
feat: Allow array for skip tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Millenium authored and Igor Muchychka committed Aug 15, 2017
1 parent 1a07a7e commit 22694a5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/runner.js
Expand Up @@ -27,20 +27,18 @@ module.exports = class Runner {
})
}

getTags (nightwatchArgv) {
let result = nightwatchArgv.tag || []
getTags (tags) {
tags = tags || []

if (typeof result === 'string') {
result = [result]
if (typeof tags === 'string') {
tags = tags.split(',')
}

return result.map((tag) => `@${tag}`)
}

getSkipTags (nightwatchArgv) {
if (!nightwatchArgv.skiptags) return []

return nightwatchArgv.skiptags.split(',').map((tag) => `@${tag}`)
if (Array.isArray(tags)) {
return tags.map((tag) => `@${tag}`)
} else {
throw new Error(`Expected tags to be Array or String.`)
}
}

featurePathToDummyPath (featureFile) {
Expand Down Expand Up @@ -81,8 +79,8 @@ module.exports = class Runner {
args: this.options.cucumberArgs,
featureFiles,
jsonReport: this.jsonReport,
tags: this.getTags(this.nightwatchApi.nightwatchArgv),
skipTags: this.getSkipTags(this.nightwatchApi.nightwatchArgv)
tags: this.getTags(this.nightwatchApi.nightwatchArgv.tag),
skipTags: this.getTags(this.nightwatchApi.nightwatchArgv.skiptags)
})
return yield * this.cucumberApi.run(cucumberArgs)
}
Expand Down

0 comments on commit 22694a5

Please sign in to comment.