| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
I fixed an error that occured in the test case of the file test/parallel/test-assert-fail.js when foo was in the path to the git clone. This occured due to a regex that looked only for the word foo, and so it was updated to not look for foo/, but only foo. This way it won't go off from foo being in the path to the git clone"
| assert.throws( | ||
| function foo() { assert.fail('first', 'second', 'message', '!==', foo); }, | ||
| (err) => !/foo/m.test(err.stack) | ||
| (err) => !/foo(?!\/)/m.test(err.stack) |
There was a problem hiding this comment.
This is enough to cover /path/with/foo/node, but it wouldn’t catch e.g. /path/with/foo-bar/node (or, for that matter, Windows paths that use \), right?
It still looks good to me as it’s strictly an improvement, but maybe there are better options.
It might be enough if the regex checks for (whitespace)at foo , because that’s how the function names show up?
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, I was unsure of what this error would actually look like, as the error message I received was in this block:
AssertionError [ERR_ASSERTION]: message
at tryBlock (assert.js:595:5)
at innerThrows (assert.js:614:18)
at Function.throws (assert.js:641:3)
at Object.<anonymous> (/Users/SwimmingSage/githubProjects/**foo**/node/test/parallel/test-assert-fail.js:68:8)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
So I simply tried to catch for that case, would you happen to know by chance where in that block foo would be mentioned if an actual error went off? I didn't want to be too specific as I was worried about interfering when there actually should be an error. But I definitely agree that this can be made more specific
Sorry, something went wrong.
There was a problem hiding this comment.
Oh sorry, I just saw that you did in fact mention that, my apologies, I will edit it for:
(whitespace)at foo
Thank your for your feedback!
Sorry, something went wrong.
There was a problem hiding this comment.
So I simply tried to catch for that case, would you happen to know by chance where in that block foo would be mentioned if an actual error went off?
What this part of the test verifies is that the last argument to assert.fail in function foo() { assert.fail('first', 'second', 'message', '!==', foo); }, (the , foo one) is not ignored. If you remove that bit, you’ll see something like an additional at foo line near the top.
(Since this is obviously not obvious, you could add a comment here that explains what the test does as well?)
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, will do, thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
BTW, it seems that /m flag is redundant here, as it is useful only if ^$ symbols are used.
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, I'll get rid of that then, thank you for the feedback!
Sorry, something went wrong.
| assert.throws( | ||
| function foo() { assert.fail('first', 'second', 'message', '!==', foo); }, | ||
| (err) => !/foo/m.test(err.stack) | ||
| (err) => !/\sat\sfoo/.test(err.stack) |
There was a problem hiding this comment.
Maybe /\sat\sfoo\b/ to be extra careful?
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, I can do that, thank you for the feedback again
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks!
One tiny suggestion for even more strictness: start with ^\s* 😄
Sorry, something went wrong.
|
@addaleax Done, thank you for the suggestion! |
Sorry, something went wrong.
|
@addaleax is this ^ OK without the /m flag? Should we check only the first stack line? |
Sorry, something went wrong.
|
@vsemozhetbyt Aaaah sorry yes, it should get the /m flag again. |
Sorry, something went wrong.
|
@SwimmingSage Thank you for the patience and sorry for all the nudging. Can you add the /m flag again? |
Sorry, something went wrong.
|
@vsemozhetbyt Yeah, I just did, and no worries, this is my first time helping out on an open source project and I greatly appreciate the feedback |
Sorry, something went wrong.
Sorry, something went wrong.
|
Two windows failures due to inspector/test-inspector-stop-profile-after-done (seems unrelated?) |
Sorry, something went wrong.
@vsemozhetbyt Yes, unfortunately that test seems to be in perma-failure mode right now. #14507 |
Sorry, something went wrong.
|
Landed in 1424e9e, thanks for the contribution! |
Sorry, something went wrong.
I fixed an error that occured in the test case of the file test/parallel/test-assert-fail.js when foo was in the path to the git clone. This occured due to a regex that looked only for the word foo, and so it was updated to not look for foo/, but only foo. This way it won't go off from foo being in the path to the git clone PR-URL: #14506 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
I fixed an error that occured in the test case of the file test/parallel/test-assert-fail.js when foo was in the path to the git clone. This occured due to a regex that looked only for the word foo, and so it was updated to not look for foo/, but only foo. This way it won't go off from foo being in the path to the git clone PR-URL: #14506 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
| Back | FazBrowse Home | New Git URL |
I fixed an error that occurred in the test case of the file
test/parallel/test-assert-fail.js when foo was in the path to
the git clone. This occurred due to a regex that looked only for the
word foo, and so it was updated to not look for foo/, but only
foo. This way it won't go off from foo being in the path to the
git clone.
What this part of the test verifies is that the last argument
to assert.fail in
function foo() { assert.fail('first', 'second', 'message', '!==', foo); },
(the , foo one) is not ignored. If it is ignored an error would appear
stating at foo near the top of the error message, thus if the path
contains foo it will not trigger the error message
Checklist
Affected core subsystem(s)
test