-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(vitest): allow conditional context.skip(boolean)
#7659
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
feat(vitest): allow conditional context.skip(boolean)
#7659
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
context.skip(boolean)
AriPerkkio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is this any different from following:
test('skipped test', (context) => {
- Math.random() < 0.5 && context.skip('optional message')
+ context.skip(Math.random() < 0.5, 'optional message')
// Test skipped, no error
assert.equal(Math.sqrt(4), 3)
})
It is not different, just a syntactic sugar. See playwright for example: https://playwright.dev/docs/api/class-testinfo#test-info-skip-2 We already support |
Co-authored-by: Ari Perkkiö <[email protected]>
|
If playwright has it, sounds good to me.
That would not be collected as skipped test though, so not equivalent. |
hi-ogawa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've seen on playwright before and I thought why not 👍
Description
I was writing tests and notice that it would be nice to have this during the test in case users provide
text.extendoverrides and can't usetest.skipIf()during collection:Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.