Skip to content
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

fix: remove bluebird #436

Closed
wants to merge 10 commits into from
Closed

Conversation

talentlessguy
Copy link

This PR removes Bluebird as it is no longer needed in 2024. All runtimes and browsers (except IE11, which a package consumer should load polyfill for) support Promise API.

All tests pass, no fancy features of Promise are used, just the Promise constructor.

Copy link

linux-foundation-easycla bot commented Jun 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

let subproc = new SubProcess('tail', ['-f', path.resolve(__filename)]);
await subproc.start();
subproc.start();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure it is a good idea to remove await from here

Copy link
Contributor

Choose a reason for hiding this comment

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

same above

Copy link
Author

Choose a reason for hiding this comment

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

The executor function can also be an async function . However, this is usually a mistake, for a few reasons: If an async executor function throws an error, the error will be lost and won't cause the newly-constructed Promise to reject. This could make it difficult to debug and handle some errors.

from eslint docs

Copy link
Author

Choose a reason for hiding this comment

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

I refactored those two tests to use simple async / await. Event listeners are sync functions anyway and don't support async ones (it kind of defeats the point of event listening, which is already async)

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

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

Could you sign the CLA?

.eslintrc.json Outdated Show resolved Hide resolved
Co-authored-by: Kazuaki Matsuo <[email protected]>
@talentlessguy
Copy link
Author

Just signed it

@talentlessguy talentlessguy requested a review from KazuCocoa July 1, 2024 17:18
package.json Outdated Show resolved Hide resolved
reject();
} else {
resolve();
throw new Error();
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this change would create an uncaught exception failure

Copy link
Author

Choose a reason for hiding this comment

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

I tried flipping the if statement and it stops the test, so the exception doesn't hang

signal.should.equal(stopSignal);
resolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this change works as expected in case of a failure

Copy link
Author

Choose a reason for hiding this comment

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

in the old code it would reject a promise which would return an exception and fail the test. now it just throws directly and also stops the test, so there's virtually no difference:

 1) SubProcess
       #stop
         should send the right signal to stop a proc:
     Uncaught 
  Error
      at SubProcess.<anonymous> (test/subproc-specs.js:225:19)
      at SubProcess.emit (node:events:520:28)
      at SubProcess.emit (node:domain:488:12)
      at ChildProcess.<anonymous> (lib/subprocess.js:193:14)
      at ChildProcess.emit (node:events:520:28)
      at ChildProcess.emit (node:domain:488:12)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:294:12)

package.json Outdated Show resolved Hide resolved
@talentlessguy
Copy link
Author

I guess it's not gonna get merged so I'll just close it

@talentlessguy talentlessguy deleted the remove-bluebird branch September 15, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants