-
Notifications
You must be signed in to change notification settings - Fork 404
Modernize child_process import in reconnecting socket test #1729
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
Conversation
31d4f08 to
6f2b6e3
Compare
webmaster128
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Could you update to latest main and remove the dependency changes from the PR? Then we can get this in and close #1724 – great stuff
| const ret = new Promise<void>((resolve, reject) => { | ||
| pass = resolve; | ||
| fail = reject; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a bit less boilerplate and more natural to use (done) => with an inner unnamed async function. See e.g.
it("can subscribe to block header events", (done) => {
pendingWithoutTendermint();
const testStart = ReadonlyDate.now();
(async () => {
const events: responses.NewBlockHeaderEvent[] = [];
const client = Tendermint37Client.create(rpcFactory());
const stream = client.subscribeNewBlockHeader();
expect(stream).toBeTruthy();
// ...in this codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, how would that even work?
And ideally all this code would be refactored to be Promise-y instead of callback-y to avoid this boilerplate kludge that combines the 2 styles, do you not think this is a step in the right direction and a reminder to more fully rewrite the test later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No super strong opinion. I was just remembering that we had those cases before and here it looks like a lot of boilerplate. But at the end of the day I am happy either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code is an optional field.
One-third of #1724. Closes #1724
Looks like this test code was inherited from #246
https://github.com/webpack/webpack/releases/v5.92.0
webpack added a feature that adds
node:prefixes "in runtime code," but still compile-time rejects it if it's already present in the code, and the target is a browser. Even if it's a dynamic import, which can fail.