Skip to content

test: add second argument to assert.throws() - #9987

Closed
russokj wants to merge 1 commit into
nodejs:masterfrom
russokj:fix-throw-message
Closed

test: add second argument to assert.throws()#9987
russokj wants to merge 1 commit into
nodejs:masterfrom
russokj:fix-throw-message

Conversation

@russokj

@russokjrussokj commented Dec 1, 2016

Copy link
Copy Markdown
Contributor
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-botnodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@mscdexmscdex added the events Issues and PRs related to the events subsystem / EventEmitter. label Dec 1, 2016
@imyllerimyller 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
Copy Markdown
Contributor

Please see the commit message guidelines here.

@russokjrussokj 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
Copy Markdown
ContributorAuthor

Updated the commit message to hopefully follow guidelines

@russokjrussokj closed this Dec 5, 2016
@russokjrussokj reopened this Dec 5, 2016

@cjihrigcjihrig left a comment

Copy link
Copy Markdown
Contributor

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.

@jasnelljasnell 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.

Almost there!

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 checks would be more useful with a regexp as the second argument rather than simply Error:

assert.throws(function(){e.setMaxListeners(NaN);},/^TypeError:"n"argumentmustbeapositivenumber$/);

@Trott

Copy link
Copy Markdown
Member

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

Trott commented Dec 24, 2016

Copy link
Copy Markdown
Member

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

@Trott

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Landed in 1fddf5b

@jasnelljasnell closed this Dec 24, 2016
@Trott

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

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>
@evanlucasevanlucas mentioned this pull request Jan 3, 2017
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>
@MylesBorinsMylesBorins 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-and-learnIssues related to the Code-and-Learn events and PRs submitted during the events.eventsIssues and PRs related to the events subsystem / EventEmitter.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@russokj@mscdex@Trott@jasnell@cjihrig@MylesBorins@imyller@targos@nodejs-github-bot