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

[v10.x backport] tools, test: forbid string literal as third argument for assert.strictEqual() and friends #22912

Closed
wants to merge 12 commits into from

Commits on Sep 17, 2018

  1. test: remove string literal message from assertion

    Remove string literal message in assert.strictEqual() call in napi test
    testFinalizer.js.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    8b69c00 View commit details
    Browse the repository at this point in the history
  2. test: remove string literal message in assertions

    Remove string literal message in assert.strictEqual() calls in
    test-async-await.js.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    9579f7a View commit details
    Browse the repository at this point in the history
  3. test: improve assertion in test-inspector.js

    Remove an unecessary string literal from assert.strictEqual() call in
    test-inspector.js. The string literal is printed instead of the value
    that causes an error. Removing the string literal allows the value that
    caused the error to be printed. This improves the troubleshooting
    experience when the test fails due to that assertion.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    efe0d17 View commit details
    Browse the repository at this point in the history
  4. test: simplify assertion in http2 tests

    In test-http2-timeout-large-write.js and
    test-http2-timeout-large-write-file.js:
    
    Use assert.ok() on a boolean that the test itself creates and sets,
    rather than assert.strictEqual(). This allows us to use a static message
    without running afoul of the upcoming "do not use string literals with
    assert.strictEqual()" lint rule.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    d1c0f51 View commit details
    Browse the repository at this point in the history
  5. test: refactor flag check

    Refactor test-vm-run-in-new-context so that check for `--expose-gc` flag
    will not run afoul of an upcoming lint rule that checks that string
    literals are not used for the `message` argument of
    `assert.strictEqual()`.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    c924e16 View commit details
    Browse the repository at this point in the history
  6. test: remove string literal from assertion

    Remove string literal from `assert.strictEqual()` call `message`
    parameter and make it a comment above the assertion instead.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    bc9ae8e View commit details
    Browse the repository at this point in the history
  7. test: remove string literal message from assertion

    Remove string literal from assert.strictEqual message to improve output
    of AssertionError.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    8e4fc42 View commit details
    Browse the repository at this point in the history
  8. test: remove string literal arg from assertion

    Remove unnecessary string literal from assert.deepStrictEqual() call.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    495bb6d View commit details
    Browse the repository at this point in the history
  9. test: remove string literal from assertion

    Remove string literal as assertion message in call to
    assert.strictEqual() in test-dns-resolveany-bad-ancount.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    1db83a7 View commit details
    Browse the repository at this point in the history
  10. test: remove string literal from assertion

    Remove string literal as assertion message in call to
    assert.strictEqual() in test-dns-lookup.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    b423af6 View commit details
    Browse the repository at this point in the history
  11. test: prepare test-assert for strictEqual linting

    Make minor modifications to test-assert.js to prepare it for linting
    rule that forbids the use of string literals for the third argument of
    assert.strictEqual().
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    dcf4a35 View commit details
    Browse the repository at this point in the history
  12. tools: prevent string literals in some assertions

    String literals provided as the third argument to assert.strictEqual()
    or assert.deepStrictEqual() will mask the values that are causing
    issues. Use a lint rule to prevent such usage.
    
    PR-URL: nodejs#22849
    Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Trott committed Sep 17, 2018
    Configuration menu
    Copy the full SHA
    f6f5920 View commit details
    Browse the repository at this point in the history