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

assert.fail() accept a single argument or two arguments #12293

Closed
wants to merge 3 commits into from

Commits on Apr 12, 2017

  1. assert: improve assert.fail() API

    assert.fail() has two possible function signatures, both of which are
    not intuitive. It virtually guarantees that people who try to use
    assert.fail() without carefully reading the docs will end up using it
    incorrectly.
    
    This change maintains backwards compatibility with the two valid uses
    (arguments 1 2 and 4 supplied but argument 3 falsy, and argument 3
    supplied but arguments 1 2 and 4 all falsy) but also adds the far more
    intuitive first-argument-only and first-two-arguments-only
    possibilities.
    
    assert.fail('boom');
    // AssertionError: boom
    
    assert.fail('a', 'b');
    // AssertionError: 'a' != 'b'
    Trott committed Apr 12, 2017
    Configuration menu
    Copy the full SHA
    e4e98ba View commit details
    Browse the repository at this point in the history
  2. tools: remove assert.fail() lint rule

    assert.fail() has been updated to accept a single argument so that is no
    longer an error. Remove lint rule that checks for assert.fail() with a
    single argument.
    Trott committed Apr 12, 2017
    Configuration menu
    Copy the full SHA
    00bbb98 View commit details
    Browse the repository at this point in the history
  3. test: remove common.fail()

    common.fail() was added to paste over issues with assert.fail() function
    signature. assert.fail() has been updated to accept a single argument so
    common.fail() is no longer necessary.
    Trott committed Apr 12, 2017
    Configuration menu
    Copy the full SHA
    ec6c10e View commit details
    Browse the repository at this point in the history