Skip to content

Commit

Permalink
Correct an issue with string stepDefinitions
Browse files Browse the repository at this point in the history
This fixes #781.
  • Loading branch information
badeball committed Jul 31, 2022
1 parent e450dc1 commit 33daa87
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions features/issues/781.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://github.com/badeball/cypress-cucumber-preprocessor/issues/781

Feature: non-array step definitions, not matching
Scenario: non-array step definitions, not matching
Given additional preprocessor configuration
"""
{
"stepDefinitions": "foo/bar"
}
"""
And a file named "cypress/e2e/a.feature" with:
"""
Feature: a feature
Scenario: a scenario
Given an undefined step
"""
When I run cypress
Then it fails
And the output should contain
"""
Step implementation missing for "an undefined step".
We tried searching for files containing step definitions using the following search pattern templates:
- foo/bar
These templates resolved to the following search patterns:
- foo/bar
These patterns matched **no files** containing step definitions. This almost certainly means that you have misconfigured `stepDefinitions`.
"""
4 changes: 2 additions & 2 deletions lib/create-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface CompositionContext {
stack: messages.IEnvelope[];
};
stepDefinitionHints: {
stepDefinitions: string[];
stepDefinitions: string | string[];
stepDefinitionPatterns: string[];
stepDefinitionPaths: string[];
};
Expand Down Expand Up @@ -862,7 +862,7 @@ function createMissingStepDefinitionMessage(
.replaceAll("<text>", text)
.replaceAll(
"<step-definitions>",
prettyPrintList(stepDefinitionHints.stepDefinitions)
prettyPrintList([stepDefinitionHints.stepDefinitions].flat())
)
.replaceAll(
"<step-definition-patterns>",
Expand Down

0 comments on commit 33daa87

Please sign in to comment.