-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
removed 3rd arg from assert.throws() and changed assert.strict to ass… #22016
Changes from 1 commit
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 |
---|---|---|
|
@@ -37,12 +37,10 @@ let caught = false; | |
assert.throws( | ||
function() { execSync('exit -1', { shell: 'bad_shell' }); }, | ||
/spawnSync bad_shell ENOENT/, | ||
'execSync did not throw the expected exception!' | ||
); | ||
assert.throws( | ||
function() { execFileSync('exit -1', { shell: 'bad_shell' }); }, | ||
/spawnSync bad_shell ENOENT/, | ||
'execFileSync did not throw the expected exception!' | ||
); | ||
|
||
let cmd, ret; | ||
|
@@ -56,7 +54,7 @@ try { | |
} finally { | ||
assert.strictEqual(ret, undefined, | ||
`should not have a return value, received ${ret}`); | ||
assert.strictEqual(caught, true, 'execSync should throw'); | ||
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. This should not be changed. 1. caught should be a boolean and ok does a loose equal check. 2. The second argument would now be the error message and the third argument would be ignored. 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. IMO, this should definitely be changed, but not the way it is in this PR right now. There are at least two options. Since assert.ok(caught, 'execSync should throw'); Alternatively, if you want to insist on // execSync should throw
assert.strictEqual(caught, true); I think either of these options are better than what's there now. 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. Changed |
||
assert.ok(caught, true, 'execSync should throw'); | ||
const end = Date.now() - start; | ||
assert(end < SLEEP); | ||
assert(err.status > 128 || err.signal); | ||
|
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.
Can you remove the trailing comma here and below.
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.
Removed trailing commas.