| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
In a couple of places (like here) the doesNotThrow() is really a comment in disguise.
Someone reading the new code might be confused and think the sub.test(i) is a bug or dead code because the return value isn't checked, not realizing it's there to check a side effect (throwing an exception.)
I would suggest rewriting lines like these to sub.test(i); // Should not throw.. Apart from that getting rid of doesNotThrow() is (IMO) a good move.
Sorry, something went wrong.
There was a problem hiding this comment.
I went through the code and added comments were I felt it made sense. Some times I also improved a few tests along the way and added punctuation and caps and things like that.
Sorry, something went wrong.
|
I went through the code and added comments were I felt it made sense that it should not throw. Some times I also improved a few tests along the way and added punctuation and caps and things like that. I also removed one that was outdated. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, still LGTM at a quick glance.
Sorry, something went wrong.
|
Rebased due to conflicts. Light-CI https://ci.nodejs.org/job/node-test-commit-light/252/ |
Sorry, something went wrong.
There was a problem hiding this comment.
Rubber stamp LGTM
Sorry, something went wrong.
|
I added two more commits: the first one cleans up the rest of the doesNotThrow statements that should not be there (I did not do most of those before because of a otherwise conflicting PR that landed in the meanwhile). The second commit adds a eslint rule to prohibit the usage of assert.doesNotThrow. I could of course also remove that commit again and open a separate PR for it after this lands. I just thought it can probably also be included here. Is everyone fine with that? |
Sorry, something went wrong.
Sorry, something went wrong.
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throw, just let the error bubble up right away instead of first catching it and then rethrowing it.
Add punctuation and comments about code that should not throw.
Prohibit the usage of `assert.doesNotThrow()`.
|
Rebased due to conflicts. |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
Backported in #19244 @MylesBorins I am not certain in what way this correlates to the mentioned PR? |
Sorry, something went wrong.
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Add punctuation and comments about code that should not throw. Also remove a obsolete test and refactor some tests. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Prohibit the usage of `assert.doesNotThrow()`. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. Backport-PR-URL: #19244 PR-URL: #18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Add punctuation and comments about code that should not throw. Also remove a obsolete test and refactor some tests. Backport-PR-URL: #19244 PR-URL: #18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Prohibit the usage of `assert.doesNotThrow()`. Backport-PR-URL: #19244 PR-URL: #18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
There is actually no reason to use `assert.doesNotThrow()` in the tests. If a test throws, just let the error bubble up right away instead of first catching it and then rethrowing it. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Add punctuation and comments about code that should not throw. Also remove a obsolete test and refactor some tests. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Prohibit the usage of `assert.doesNotThrow()`. PR-URL: nodejs#18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
| Back | FazBrowse Home | New Git URL |
There is actually no reason to use assert.doesNotThrow() in the tests. If a test threw, just let the error bubble up right away instead of first catching it and then rethrowing it. That way we get the best stack trace and normally also the best possible error message.
Someone might argue that there are rare cases (I guess about 10) where it would actually make sense to keep the current behavior. The reason would be that a loop is used to execute something and a generated error message would be thrown that is individual per entry. Otherwise it might be hard to know what entry failed.
Nevertheless, I think a better way to deal with those would be to add a console.log. And we can add those as soon as something fails.
I can not think of any other reason to keep assert.doesNotThrow(). I personally feel we might want to deprecate that function actually.
I kept the calls in the assertion test file because I work on that right now in a different PR and those mainly test assert.doesNotThrow() on its own.
Checklist
Affected core subsystem(s)
test