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

[v6.x backport] assert.fail() accept a single argument or two arguments #15479

Closed
wants to merge 4 commits into from

Commits on Sep 29, 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'
    
    PR-URL: nodejs#12293
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Trott committed Sep 29, 2017
    Configuration menu
    Copy the full SHA
    d25b8de 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.
    
    PR-URL: nodejs#12293
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Trott committed Sep 29, 2017
    Configuration menu
    Copy the full SHA
    7c10194 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.
    
    PR-URL: nodejs#12293
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Trott committed Sep 29, 2017
    Configuration menu
    Copy the full SHA
    e5b11f8 View commit details
    Browse the repository at this point in the history
  4. test: add cwd ENOENT known issue test

    If the current working directory is removed, Node cannot
    start normally because the module system calls uv_cwd().
    
    Refs: nodejs#12022
    PR-URL: nodejs#12343
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    cjihrig authored and Trott committed Sep 29, 2017
    Configuration menu
    Copy the full SHA
    1f4b70b View commit details
    Browse the repository at this point in the history