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

tools: add ESLint rule for assert.throws arguments #10089

Merged
merged 1 commit into from
Dec 5, 2016

Commits on Dec 5, 2016

  1. tools: add ESLint rule for assert.throws arguments

    The second argument to "assert.throws" is usually a validation RegExp or
    function for the thrown error. However, the function also accepts a
    string and in this case it is interpreted as a message for the
    AssertionError and not used for validation. It is common for people to
    forget this and pass a validation string by mistake.
    This new rule checks that we never pass a string literal as a second argument
    to "assert.throws". Additionally, there is an option to enforce the
    function to be called with at least two arguments. It is currently off
    because we have many tests that do not comply with this rule.
    
    PR-URL: nodejs#10089
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    targos committed Dec 5, 2016
    Configuration menu
    Copy the full SHA
    0ae1684 View commit details
    Browse the repository at this point in the history