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: refactor several parallel/test-timer tests #10524

Closed
wants to merge 2 commits into from

Conversation

BethGriggs
Copy link
Member

Change var to const/let. Simplify test-timers-uncaught-exception.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Refactored several of the parallel/test-timer-* tests - mainly changing vars to const and adding common.mustCall() where possible. parallel/test-timers-uncaught-exception has been simplified. Any further suggestions for improvement are welcome 😄

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 29, 2016

var f = function(i) {
const f = function(i) {
if (i <= N) {
// check order
assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' +
Copy link
Member

@Trott Trott Dec 29, 2016

Choose a reason for hiding this comment

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

Since you're already in here refactoring, could you also change the assert.equal() on this line to assert.strictEqual()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated - I missed that one

@mscdex mscdex added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label Dec 29, 2016
@Trott
Copy link
Member

Trott commented Dec 29, 2016

CI: https://ci.nodejs.org/job/node-test-pull-request/5624/ (although I guess we'll want to re-run it after the assert.equal() -> assert.strictEqual() change happens, but that's OK, might as well find any oddball platform-specific things that might be there sooner than later)

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

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

Also, does test-timers-uncaught-exception.js still work even if you reduce the delays to 1?

process.on('exit', function() {
assert(!exited);
exited = true;
process.removeListener('uncaughtException', uncaughtException);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will fail because what was actually registered was a function returned from common.mustCall().

I don't think you can have async errors during exit though, so this should be unnecessary I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the whole function.

Change var to const/let. Simplify test-timers-uncaught-exception.
@BethGriggs
Copy link
Member Author

@Fishrock123 updated to address comments, PTAL. Test still passes with 1ms timeout.

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

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

@gibfahn gibfahn self-assigned this Jan 3, 2017
@gibfahn
Copy link
Member

gibfahn commented Jan 3, 2017

Landed in 7c77932

@gibfahn gibfahn closed this Jan 3, 2017
gibfahn pushed a commit that referenced this pull request Jan 3, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: #10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: nodejs#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 19, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: nodejs#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
targos pushed a commit that referenced this pull request Jan 28, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: #10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: nodejs#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: nodejs#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Would someone be willing to backport?

BethGriggs added a commit to BethGriggs/node that referenced this pull request Apr 18, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: nodejs#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 24, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

Backport-PR-URL: #12401
PR-URL: #10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 24, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

Backport-PR-URL: #12401
PR-URL: #10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 29, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
Change var to const/let. Simplify test-timers-uncaught-exception.

Backport-PR-URL: nodejs/node#12401
PR-URL: nodejs/node#10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@BethGriggs BethGriggs deleted the pr-test-timers-es6 branch February 21, 2018 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants