-
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
test: assert unused vars in test-cli-eval.js #10759
Conversation
@@ -19,13 +19,15 @@ const filename = __filename.replace(/\\/g, '/'); | |||
// assert that nothing is written to stdout | |||
child.exec(nodejs + ' --eval 42', | |||
function(err, stdout, stderr) { | |||
assert.strictEqual(err, null); |
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.
These will work and are totally fine, but it's probably more idiomatic to do this:
assert.ifError(err);
@@ -36,12 +38,14 @@ child.exec(nodejs + ' --eval "console.error(42)"', | |||
|
|||
child.exec(cmd + '42', | |||
function(err, stdout, stderr) { | |||
assert.strictEqual(typeof err, 'object'); |
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.
This is OK, but is probably better like this:
assert(err instanceof Error);
Even better if the type of error is known. For example, if it's expected to be a RangeError
, then assert.(err instanceof RangeError)
etc.
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.
LGTM if CI is green, although if you want to make the changes in the nits I left, even better.
I suspect that ideally |
@Trott made a commit to rename |
LGTM. Let's run CI again... |
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: #10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in b9adbf2 |
Looks like this broke the CI on Windows. Fix in #10840. |
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: nodejs#10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: nodejs#10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: #10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: nodejs#10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: nodejs#10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport If it is backported please include #10840 |
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: #10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: #10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* assert unused vars in test-cli-eval.js * assert in more idiomatic way test-cli-eval * rename status to err in test-cli-eval.js PR-URL: nodejs/node#10759 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Assert unused variables in test-cli-eval.js
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test