feat(vitest): allow conditional context.skip(boolean)#7659
feat(vitest): allow conditional context.skip(boolean)#7659sheremet-va merged 3 commits intovitest-dev:mainfrom
context.skip(boolean)#7659Conversation
✅ 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.
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.
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:.