Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ctx.todo() #6212

Closed
4 tasks done
flowt-au opened this issue Jul 24, 2024 · 2 comments · Fixed by #6805
Closed
4 tasks done

Support for ctx.todo() #6212

flowt-au opened this issue Jul 24, 2024 · 2 comments · Fixed by #6805
Labels
p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome

Comments

@flowt-au
Copy link

Clear and concise description of the problem

I am using vitest-cucumber which is great. An upcoming release will support the Vitest ctx.skip() option by passing the ctx into the test (like Vitest does) like this:

Then(`the result of test "<id>" should be <result>`, (ctx) => {
      ctx.skip()
})

I know in Vitest this is possible: test.todo('unimplemented test') but that can't be done in vitest-cucumber.

Suggested solution

I would love the option of ctx.todo(myMessage) so I can write all the Gherkin, set the tests to have ctx.todo() then have them work like the test.todo('unimplemented test') does, with the addition of an optional custom message.

Then(`the result of test "<id>" should be <result>`, (ctx) => {
      ctx.todo('Waiting for the client to ok this idea')
})

I think this would be of use to non-BDD testers too.

Alternative

No response

Additional context

Anyway, thanks for a great library!
Murray

Validations

@sheremet-va
Copy link
Member

I don't really understand where the optional message is reported? ctx.skip just marks the test as skip and keeps its name.

@flowt-au
Copy link
Author

What I am proposing is that the additional message could appear on the report. Remembering that with BDD the feature files and step definitions are often written before any code and non-developers are often part of that spec development process.

At present, with ctx.skip() it says:

Then the result of test "three" should be 35 [skipped]

What I am suggesting is something like:

Then the result of test "three" should be 35 [ToDo: Waiting for the client to ok this idea]

or just:

Then the result of test "three" should be 35 [ToDo]

meaning this feature is not yet written, or whatever else the team decides it means.

This way, if the client or other non-developers are part of the BDD process they would see these comments in the report. Also, developers have more information about why a test is not executing, rather than just [skipped]. ie all the same reasons for test.todo(), just with more detail.

And, of course, if messages were also allowed in skip() devs could say why it was skipped, and others who cannot see the comments in the test implementation would have more information.

Thanks,
Murray

@sheremet-va sheremet-va added p2-nice-to-have Not breaking anything but nice to have (priority) and removed enhancement: pending triage labels Jul 25, 2024
@sheremet-va sheremet-va moved this to Approved in Team Board Oct 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants