Skip to content

Commit

Permalink
undefined steps always fail the test run
Browse files Browse the repository at this point in the history
resolves #867
  • Loading branch information
charlierudolph committed Aug 5, 2017
1 parent 180591f commit d59b0e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* `cucumber-expressions`:
* using an undefined parameter type now results in an error
* `{stringInDoubleQuotes}` is now `{string}` which works for strings in single or double quotes
* Undefined steps fail the build in non-strict mode. Non-strict mode only allows pending steps now.

#### New Features

Expand Down
10 changes: 1 addition & 9 deletions features/strict_mode.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Strict mode

Using the `--no-strict` flag will cause cucumber to succeed even if there are
undefined or pending steps.
pending steps.

Background:
Given a file named "features/a.feature" with:
Expand All @@ -11,14 +11,6 @@ Feature: Strict mode
Given a step
"""

Scenario: Fail with undefined step by default
When I run cucumber.js
Then it fails

Scenario: Succeed with undefined step with --no-strict
When I run cucumber.js with `--no-strict`
Then it passes

Scenario: Fail with pending step by default
Given a file named "features/step_definitions/cucumber_steps.js" with:
"""
Expand Down
5 changes: 2 additions & 3 deletions src/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ export default class Runtime {

shouldCauseFailure(status) {
return (
_.includes([Status.AMBIGUOUS, Status.FAILED], status) ||
(_.includes([Status.PENDING, Status.UNDEFINED], status) &&
this.options.strict)
_.includes([Status.AMBIGUOUS, Status.FAILED, Status.UNDEFINED], status) ||
(status === Status.PENDING && this.options.strict)
)
}
}

0 comments on commit d59b0e5

Please sign in to comment.