bencompton / jest-cucumber

Execute Gherkin scenarios in Jest
Apache License 2.0
662 stars 118 forks source link

Feature Requests: autoBindSteps should propose suitable code #167

Open drpicox opened 1 year ago

drpicox commented 1 year ago

Currently, when we are using autoBindSteps, when a step is failing the output looks like:

    Scenario "List products with no products" has 2 step(s) in the feature file, but 0 step definition(s) defined. Try adding the following code:

    test('List products with no products', ({ when, then }) => {
        when('I list products', () => {

        });

        then(/^there should be (\d+) products$/, (arg0) => {

        });
    });

But when we are using autoBindSteps, we are not using jest test directly, so the suggestion is confusing. It should be nice to change the message to something like:

    Scenario "List products with no products" has 2 step(s) in the feature file, but 0 step definition(s) defined. Try adding the following code:

    const listProductsWithNoProductsStep = ({ when, then }) => {
        when('I list products', () => {

        });

        then(/^there should be (\d+) products$/, (arg0) => {

        });
    });

Thanks and awesome job!

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

pplancq commented 7 months ago

Your proposal is interesting, and indeed when using autoBindSteps the error message can be confusing.

@bencompton Can you tag this issue in enhancement?