Skip to content

Commit 047e91f

Browse files
committed
Empty rerun file exits running no scenarios (cucumber#1302)
1 parent f7453d4 commit 047e91f

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

features/rerun_formatter.feature

+2-11
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,10 @@ Feature: Rerun Formatter
9595
When I run cucumber-js with `@rerun.txt`
9696
Then it runs the scenario "C - passing"
9797

98-
Scenario: empty rerun file
98+
Scenario: empty rerun file exits without running any scenarios
9999
Given an empty file named "@rerun.txt"
100100
When I run cucumber-js with `@rerun.txt`
101-
Then it fails
102-
And it runs the scenarios:
103-
| NAME |
104-
| A - passing |
105-
| A - failing |
106-
| A - ambiguous |
107-
| B - passing |
108-
| B - pending |
109-
| C - passing |
110-
| C - undefined |
101+
Then it passes
111102

112103
Scenario: rerun with fail fast outputs all skipped scenarios
113104
When I run cucumber-js with `--fail-fast --format rerun:@rerun.txt`

src/cli/configuration_builder.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ export default class ConfigurationBuilder {
210210
if (filename[0] === '@') {
211211
const filePath = path.join(this.cwd, arg)
212212
const content = await fs.readFile(filePath, 'utf8')
213-
return _.chain(content).split('\n').map(_.trim).compact().value()
213+
return _.chain(content).split('\n').map(_.trim).value()
214214
}
215215
return [arg]
216216
})
217217
const featurePaths = _.flatten(nestedFeaturePaths)
218218
if (featurePaths.length > 0) {
219-
return featurePaths
219+
return _.compact(featurePaths)
220220
}
221221
}
222222
return ['features/**/*.feature']

src/cli/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ export default class Cli {
181181
supportCodeLibrary,
182182
})
183183
await emitMetaMessage(eventBroadcaster)
184+
if (configuration.featurePaths.length === 0) {
185+
return { shouldExitImmediately: true, success: true }
186+
}
184187
const gherkinMessageStream = GherkinStreams.fromPaths(
185188
configuration.featurePaths,
186189
{

0 commit comments

Comments
 (0)