Skip to content
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: improve the code in test-process-hrtime #10667

Closed
wants to merge 1 commit into from

Conversation

edsadr
Copy link
Member

@edsadr edsadr commented Jan 6, 2017

  • use const instead of var
  • use assert.strictEqual instead of assert.equal and plain assert
  • use arrow functions
  • swap assertions arguments to match the standard
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-bot nodejs-github-bot added test Issues and PRs related to the tests. dont-land-on-v7.x labels Jan 6, 2017
@@ -12,16 +12,16 @@ validateTuple(tuple);
validateTuple(process.hrtime(tuple));

// test that only an Array may be passed to process.hrtime()
assert.throws(function() {
assert.throws(() => {
process.hrtime(1);
});

function validateTuple(tuple) {
assert(Array.isArray(tuple));
assert.equal(2, tuple.length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also make this one strictEqual and in the correct order?

@mscdex mscdex added the process Issues and PRs related to the process subsystem. label Jan 6, 2017
@edsadr
Copy link
Member Author

edsadr commented Jan 6, 2017

sorry @targos , missed that one... changed it now

@Trott
Copy link
Member

Trott commented Jan 8, 2017

It would be great if the assert.throws() that only has one argument could be passed a second argument to validate the error. In this case, I think it would be /^TypeError: process.hrtime\(\) only accepts an Array tuple$/.

* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
@edsadr
Copy link
Member Author

edsadr commented Jan 8, 2017

Thanks @Trott, just added it as suggested and will have in mind from now on

jasnell pushed a commit that referenced this pull request Jan 10, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: #10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@jasnell
Copy link
Member

jasnell commented Jan 10, 2017

Landed in 2685464

@jasnell jasnell closed this Jan 10, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: nodejs#10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: nodejs#10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 25, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: nodejs#10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 27, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: nodejs#10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
MylesBorins pushed a commit that referenced this pull request Mar 8, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: #10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@MylesBorins
Copy link
Contributor

This test fails on v4.x and has not been backported

MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws

PR-URL: #10667
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants