Skip to content

test: assert unused vars in test-cli-eval.js - #10759

Closed
StarryShark wants to merge 3 commits into
nodejs:masterfrom
StarryShark:testUpdates
Closed

test: assert unused vars in test-cli-eval.js#10759
StarryShark wants to merge 3 commits into
nodejs:masterfrom
StarryShark:testUpdates

Conversation

@StarryShark

Copy link
Copy Markdown
Contributor

Assert unused variables in test-cli-eval.js

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-botnodejs-github-bot added test Issues and PRs related to the tests. dont-land-on-v7.x labels Jan 12, 2017
Comment threadtest/parallel/test-cli-eval.js Outdated
// assert that nothing is written to stdout
child.exec(nodejs + ' --eval 42',
function(err, stdout, stderr) {
assert.strictEqual(err, null);

Copy link
Copy Markdown
Member

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);

Comment threadtest/parallel/test-cli-eval.js Outdated

child.exec(cmd + '42',
function(err, stdout, stderr) {
assert.strictEqual(typeof err, 'object');

Copy link
Copy Markdown
Member

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(errinstanceofError);

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.

@mscdexmscdex added process Issues and PRs related to the process subsystem. and removed dont-land-on-v7.x labels Jan 12, 2017

@TrottTrott left a comment

Copy link
Copy Markdown
Member

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.

@Trott

Copy link
Copy Markdown
Member

@Trott

Copy link
Copy Markdown
Member

I suspect that ideally status should be renamed err and treated like the err object (using assert.ifError() rather than checking for equality to null). I wouldn't hold this up over that. Might make a good next contribution, though. (If you do want to change it in this PR, though, go for it!)

@StarryShark

Copy link
Copy Markdown
ContributorAuthor

@Trott made a commit to rename status to err. please review.

@Trott

Copy link
Copy Markdown
Member

LGTM. Let's run CI again...

CI: https://ci.nodejs.org/job/node-test-pull-request/5838/

jasnell pushed a commit that referenced this pull request Jan 16, 2017
* 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>
@jasnell

Copy link
Copy Markdown
Member

Landed in b9adbf2

@jasnelljasnell closed this Jan 16, 2017
@cjihrig

Copy link
Copy Markdown
Contributor

Looks like this broke the CI on Windows. Fix in #10840.

italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
* 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>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
* 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>
targos pushed a commit that referenced this pull request Jan 28, 2017
* 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>
@italoacasasitaloacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* 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>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* 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>
@MylesBorins

Copy link
Copy Markdown
Contributor

This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport

If it is backported please include #10840

MylesBorins pushed a commit that referenced this pull request Apr 18, 2017
* 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>
MylesBorins pushed a commit that referenced this pull request Apr 19, 2017
* 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>
@MylesBorinsMylesBorins mentioned this pull request Apr 19, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
* 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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

processIssues and PRs related to the process subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@StarryShark@Trott@jasnell@cjihrig@MylesBorins@mscdex@nodejs-github-bot