Skip to content

Commit

Permalink
Empty rerun file exits running no scenarios (cucumber#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jshifflet committed Feb 7, 2021
1 parent f7453d4 commit 047e91f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
13 changes: 2 additions & 11 deletions features/rerun_formatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,10 @@ Feature: Rerun Formatter
When I run cucumber-js with `@rerun.txt`
Then it runs the scenario "C - passing"

Scenario: empty rerun file
Scenario: empty rerun file exits without running any scenarios
Given an empty file named "@rerun.txt"
When I run cucumber-js with `@rerun.txt`
Then it fails
And it runs the scenarios:
| NAME |
| A - passing |
| A - failing |
| A - ambiguous |
| B - passing |
| B - pending |
| C - passing |
| C - undefined |
Then it passes

Scenario: rerun with fail fast outputs all skipped scenarios
When I run cucumber-js with `--fail-fast --format rerun:@rerun.txt`
Expand Down
4 changes: 2 additions & 2 deletions src/cli/configuration_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ export default class ConfigurationBuilder {
if (filename[0] === '@') {
const filePath = path.join(this.cwd, arg)
const content = await fs.readFile(filePath, 'utf8')
return _.chain(content).split('\n').map(_.trim).compact().value()
return _.chain(content).split('\n').map(_.trim).value()
}
return [arg]
})
const featurePaths = _.flatten(nestedFeaturePaths)
if (featurePaths.length > 0) {
return featurePaths
return _.compact(featurePaths)
}
}
return ['features/**/*.feature']
Expand Down
3 changes: 3 additions & 0 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ export default class Cli {
supportCodeLibrary,
})
await emitMetaMessage(eventBroadcaster)
if (configuration.featurePaths.length === 0) {
return { shouldExitImmediately: true, success: true }
}
const gherkinMessageStream = GherkinStreams.fromPaths(
configuration.featurePaths,
{
Expand Down

0 comments on commit 047e91f

Please sign in to comment.