Skip to content

Conversation

@Trott
Copy link
Member

The assert.fail function signature has the message as the third argument
but, understandably, it is often assumed that it is the first argument
(or at least the first argument if no other arguments are passed).

This corrects the assert.fail() invocations in the Node.js tests.

Before:
assert.fail('message');
// result: AssertionError: 'message' undefined undefined

After:
assert.fail(null, null, 'message');
// result: AssertionError: message

The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message
@TrottTrott added the test Issues and PRs related to the tests. label Oct 15, 2015
@Trott
Copy link
MemberAuthor

@Trott
Copy link
MemberAuthor

CI looks like it was having issues building some hosts. Trying again: https://ci.nodejs.org/job/node-test-commit/847/

@cjihrig
Copy link
Contributor

LGTM. Aren't there a number of occurrences where assert.fail() is used as a callback or event handler like foo.on('event', assert.fail)? Just curious if that turned up in your search at all.

@Trott
Copy link
MemberAuthor

@cjihrig Yes, that's a thing too.

Trott added a commit that referenced this pull request Oct 16, 2015
The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message PR-URL: #3378 Reviewed-By: Colin Ihrig <[email protected]>
@Trott
Copy link
MemberAuthor

Landed in 676e618

@TrottTrott closed this Oct 16, 2015
@MylesBorins
Copy link
Contributor

@Trott assert.fail didn't change after 4.2.x right?

This should probably be backported to LTS

/cc @jasnell

@rvaggrvagg mentioned this pull request Oct 21, 2015
Trott added a commit that referenced this pull request Oct 26, 2015
The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message PR-URL: #3378 Reviewed-By: Colin Ihrig <[email protected]>
@jasnell
Copy link
Member

Landed on v4.x-staging on d540666

Trott added a commit that referenced this pull request Oct 29, 2015
The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message PR-URL: #3378 Reviewed-By: Colin Ihrig <[email protected]>
@TrottTrott deleted the assert.fail branch January 13, 2022 22:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Trott@cjihrig@MylesBorins@jasnell