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: add second argument to assert.throws() #9987

Closed
wants to merge 1 commit into from

Conversation

russokj
Copy link
Contributor

@russokj russokj commented Dec 1, 2016

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

test

Description of change

The assert throws() should include a constructor or RegExp as a second
argument.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@mscdex mscdex added the events Issues and PRs related to the events subsystem / EventEmitter. label Dec 1, 2016
@imyller imyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016
@mscdex
Copy link
Contributor

mscdex commented Dec 1, 2016

Please see the commit message guidelines here.

@russokj russokj changed the title test: assert throws() needs second argument in test/parallel/ test: add second argument to assert.throws() Dec 1, 2016
@russokj
Copy link
Contributor Author

russokj commented Dec 1, 2016

Updated the commit message to hopefully follow guidelines

@russokj russokj closed this Dec 5, 2016
@russokj russokj reopened this Dec 5, 2016
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

This is an improvement, but a regular expression would likely be better.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Almost there!

@@ -11,14 +11,14 @@ e.setMaxListeners(42);

assert.throws(function() {
e.setMaxListeners(NaN);
});
}, Error);
Copy link
Member

Choose a reason for hiding this comment

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

These checks would be more useful with a regexp as the second argument rather than simply Error:

assert.throws(function() {
  e.setMaxListeners(NaN);
}, /^TypeError: "n" argument must be a positive number$/);

@Trott
Copy link
Member

Trott commented Dec 22, 2016

Ping @russokj: Can you make the change requested by @jasnell?

The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.
@Trott
Copy link
Member

Trott commented Dec 24, 2016

@jasnell I updated @russokj's branch per your comment. Can you take a look and update your review if appropriate?

@Trott
Copy link
Member

Trott commented Dec 24, 2016

jasnell pushed a commit that referenced this pull request Dec 24, 2016
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Dec 24, 2016

Landed in 1fddf5b

@jasnell jasnell closed this Dec 24, 2016
@Trott
Copy link
Member

Trott commented Dec 24, 2016

Thanks for the contribution @russokj! 🎉

targos pushed a commit that referenced this pull request Dec 26, 2016
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@russokj
Copy link
Contributor Author

russokj commented Dec 27, 2016

Just got back from vacation - thanks for making the changes.

targos pushed a commit that referenced this pull request Dec 28, 2016
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 3, 2017
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Jan 23, 2017
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
The assert.throws() calls in test-event-emitter-max-listeners.js
should include a constructor or RegExp as a second argument.

PR-URL: #9987
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. events Issues and PRs related to the events subsystem / EventEmitter. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants