test: rewrite inspector test helper#14460
test: rewrite inspector test helper#14460eugeneo merged 0 commit intonodejs:masterfrom eugeneo:promisify-test
Conversation
|
Newer helper uses port 0 by default. Also it should now be possible to run multiple children processes (no test uses this yet). |
|
Very nice! I've implemented something like this but for |
|
@TimothyGu I would really appreciate your suggestions. I've been thinking about having a test framework that can run tests both through WebSockets and JS bindings to improve the coverage. But I am also working on moving WS codepath to use JS bindings to talk to inspector - that should make JS bindings tests less important. |
There was a problem hiding this comment.
This could be added to test/common/index.js, or you can just take my version instead :) https://github.com/TimothyGu/node/blob/15a8ff8f52a8e01f41e773ea1f4e970976625aac/test/common/index.js#L820-L838 (docs)
There was a problem hiding this comment.
I copied you version - but the issue I noticed is that the test will not complete until the timeout is fired. I implemented the timeout clearing.
There was a problem hiding this comment.
Arrow functions are preferred.
There was a problem hiding this comment.
In Node.js private properties are usually prefixed with _ not postfixed.
There was a problem hiding this comment.
I deleted "kill" (for now). It was copied from the old test and "enqueu_" is a primary reason the tests have to be rewritten :)
There was a problem hiding this comment.
Is this function intended to be public?
There was a problem hiding this comment.
Made it a standalone non-exported function.
There was a problem hiding this comment.
You might want to use common.crashOnUnhandledRejection()
There was a problem hiding this comment.
I know it doesn't matter most of the cases, but I prefer using once instead of on with promises.
There was a problem hiding this comment.
WS stuff should be factored out of this function (much like parseWSFrame above).
|
@TimothyGu Thank you for your review. Please take another look. I am more confident in this approach now so I will try to find time and port other tests now. |
test/common/index.js
Outdated
There was a problem hiding this comment.
docs should be added to test/common/README.md
There was a problem hiding this comment.
Done. I also ported a couple more test cases.
Note - I pushed a new change as a separate commit to make it easier to use the GitHub UI - I will do a proper rebase/squish before submitting the code.
test/common/index.js
Outdated
There was a problem hiding this comment.
Can you call this finally as per https://github.com/tc39/proposal-promise-finally
There was a problem hiding this comment.
finally is a reserved word. I considered promiseFinally or onFinally - but decided to be explicit...
There was a problem hiding this comment.
One hackish way around that is to set the name property on the function after it is defined. E.g.
function onResolvedOrRejected(promise, callback) { /* ... */ }
onResolvedOrRejected.name = 'finally';But I definitely do not see that as being critical.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/9466/ I ported all the tests to a new framework. I also renamed test cases to remove "-inspector" from the file name - they all reside in the "inspector" folder so there is no need to repeat it in the file name. |
|
Performed a rebase. New CI: https://ci.nodejs.org/job/node-test-pull-request/9578/ |
|
Apparently, last CI run was cancelled. New CI: https://ci.nodejs.org/job/node-test-pull-request/9603/ |
|
CI did not show any relevant failures. This PR landed as https://github.com/eugeneo/node/commit/2296b677fb1e2ea71e86a899b028ba9e817e86ad. |
This reverts commit 2296b67. That commit was landed without a green CI and is failing on Windows. Ref: nodejs#14460
Helper was rewritten to rely on promises instead of manually written
queue and callbacks. This simplifies the code and makes it easier to
maintain and extend.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test: 2 of the inspector tests were rewritten with a new framework.
This is a work in progress. I would be grateful for any feedback before I port other tests on this new helper API.