FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: fix assert.throws in test-http-invalid-urls by Trott · Pull Request #15678 · nodejs/node · GitHub

/ node Public

test: fix assert.throws in test-http-invalid-urls - #15678

Closed
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:assert-throws-booboo
Closed

test: fix assert.throws in test-http-invalid-urls#15678
Trott wants to merge 1 commit into
nodejs:masterfrom
Trott:assert-throws-booboo

Conversation

Trott commented Sep 29, 2017
edited
Loading

Copy link
Copy Markdown
Member

When the second argument to assert.throws() is a string, it is not
treated as the expected error message but rather the message that the
assertion should display if no error is thrown. Ths change fixes that
error in test-http-invalid-urls.js.

Instead of skipping the test when there is no crypto, the test is now
run but with http only. https is skipped.

Logging was fixed. Previously, errors would be written out as being in
the [object Object] module rather than http or https.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Trott added the test Issues and PRs related to the tests. label Sep 29, 2017

Trott commented Sep 29, 2017

Copy link
Copy Markdown
Member Author

@BridgeAR

mscdex added the http Issues or PRs related to the http subsystem. label Sep 29, 2017
Comment thread test/parallel/test-http-invalid-urls.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: how about replacing this with common.mustNotCall()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sure. And while I'm at it, I can add { and } around the arrow function body because there's no need for it to implicitly return a value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Found other problems in the process. Refactored/fixed/commented in the commit message.

Trott force-pushed the assert-throws-booboo branch from f19a178 to 5db3a8b Compare September 29, 2017 22:04
When the second argument to `assert.throws()` is a string, it is not
treated as the expected error message but rather the message that the
assertion should display if no error is thrown. Ths change fixes that
error in `test-http-invalid-urls.js`.

Instead of skipping the test when there is no crypto, the test is now
run but with `http` only. `https` is skipped.

Logging was fixed. Previously, errors would be written out as being in
the `[object Object]` module rather than `http` or `https`.
Trott force-pushed the assert-throws-booboo branch from 5db3a8b to a263630 Compare September 29, 2017 22:05

Trott commented Sep 29, 2017

Copy link
Copy Markdown
Member Author

BridgeAR commented Oct 1, 2017

Copy link
Copy Markdown
Member

Landed in 2e215f1

BridgeAR closed this Oct 1, 2017
BridgeAR pushed a commit that referenced this pull request Oct 1, 2017
When the second argument to `assert.throws()` is a string, it is not
treated as the expected error message but rather the message that the
assertion should display if no error is thrown. Ths change fixes that
error in `test-http-invalid-urls.js`.

Instead of skipping the test when there is no crypto, the test is now
run but with `http` only. `https` is skipped.

Logging was fixed. Previously, errors would be written out as being in
the `[object Object]` module rather than `http` or `https`.

PR-URL: #15678
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

Copy link
Copy Markdown
Contributor

When cherry-picked to 8.x this test is failing. Could you please backport

Trott commented Oct 4, 2017

Copy link
Copy Markdown
Member Author

@MylesBorins The test change is dependent on #14423 which is semver-major. I'll label this "dont-land" on 8, 6, and 4.

addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 4, 2017
When the second argument to `assert.throws()` is a string, it is not
treated as the expected error message but rather the message that the
assertion should display if no error is thrown. Ths change fixes that
error in `test-http-invalid-urls.js`.

Instead of skipping the test when there is no crypto, the test is now
run but with `http` only. `https` is skipped.

Logging was fixed. Previously, errors would be written out as being in
the `[object Object]` module rather than `http` or `https`.

PR-URL: nodejs/node#15678
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Trott deleted the assert-throws-booboo branch January 13, 2022 22:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL