-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
test_runner: make skip/todo/expectFailure use JS truthiness #62346
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
0a28ef2
c96d866
58be01d
56ab67a
6014f0a
814ea72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 'use strict'; | ||
|
|
||
| const common = require('../common'); | ||
| const { test } = require('node:test'); | ||
|
|
||
| test('skip option empty string should not skip', { skip: '' }, common.mustCall()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not? this seems wrong to me
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would fix the docs, not the implementation - it seems for correct
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can see why both behaviors would make sense.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback! I based this change on the docs describing these options as "truthy", so I assumed an empty string ('') should be treated as false. That said, I see your point — changing the implementation could introduce unintended breaking behavior. Updating the docs to reflect the current behavior sounds reasonable. I'm happy to update this PR to focus on the docs instead. Let me know what you prefer!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's a decent chance an empty string is an accident, but the user could be relying on something that outputs a potentially empty string. I think in general, truthy/falsy makes sense; since that includes an empty string, yeah. I'm not sure what others do. I'll take a look this evening.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like jest and mocha do not have this—they expose them only as methods like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tape has this, and uses truthiness. |
||
Uh oh!
There was an error while loading. Please reload this page.