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

Conversation

Trott
Copy link
Member

@Trott Trott commented Sep 17, 2018

Backport of #22849.

@targos

Remove string literal message in assert.strictEqual() call in napi test
testFinalizer.js.

PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Remove string literal message in assert.strictEqual() calls in
test-async-await.js.

PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Remove string literal from assert.strictEqual message to improve output
of AssertionError.

PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Remove unnecessary string literal from assert.deepStrictEqual() call.

PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Remove string literal as assertion message in call to
assert.strictEqual() in test-dns-lookup.

PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@Trott
Copy link
Member Author

Trott commented Sep 17, 2018

@addaleax
Copy link
Member

targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal message in assert.strictEqual() call in napi test
testFinalizer.js.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal message in assert.strictEqual() calls in
test-async-await.js.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
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.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
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.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
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()`.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal from `assert.strictEqual()` call `message`
parameter and make it a comment above the assertion instead.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal from assert.strictEqual message to improve output
of AssertionError.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove unnecessary string literal from assert.deepStrictEqual() call.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal as assertion message in call to
assert.strictEqual() in test-dns-resolveany-bad-ancount.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 19, 2018
Remove string literal as assertion message in call to
assert.strictEqual() in test-dns-lookup.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal message in assert.strictEqual() call in napi test
testFinalizer.js.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal message in assert.strictEqual() calls in
test-async-await.js.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
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.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
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.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
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()`.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal from `assert.strictEqual()` call `message`
parameter and make it a comment above the assertion instead.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal from assert.strictEqual message to improve output
of AssertionError.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove unnecessary string literal from assert.deepStrictEqual() call.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal as assertion message in call to
assert.strictEqual() in test-dns-resolveany-bad-ancount.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
Remove string literal as assertion message in call to
assert.strictEqual() in test-dns-lookup.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
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().

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
targos pushed a commit that referenced this pull request Sep 20, 2018
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.

Backport-PR-URL: #22912
PR-URL: #22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
kjin pushed a commit to kjin/node that referenced this pull request Oct 3, 2018
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.

Backport-PR-URL: nodejs#22912
PR-URL: nodejs#22849
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@Trott Trott deleted the v10.x-backport-22849 branch January 13, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants