-
Notifications
You must be signed in to change notification settings - Fork 79
Add polyfill for AbortSignal.any() for Node.js <= 20.3.0 #1322
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,51 @@ const DistroUtils = require('./distro.js'); | |||||||||
| const Entity = require('./entity.js'); | ||||||||||
| const debug = require('debug')('rclnodejs:client'); | ||||||||||
|
|
||||||||||
| // Polyfill for AbortSignal.any() for Node.js <= 20.3.0 | ||||||||||
| // AbortSignal.any() was added in Node.js 20.3.0 | ||||||||||
|
Comment on lines
+22
to
+23
|
||||||||||
| // Polyfill for AbortSignal.any() for Node.js <= 20.3.0 | |
| // AbortSignal.any() was added in Node.js 20.3.0 | |
| // Polyfill for AbortSignal.any() for Node.js < 20.3.0 | |
| // AbortSignal.any() was added in Node.js 20.3.0; this polyfill is needed for Node.js versions below 20.3.0 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -260,6 +260,14 @@ describe('Client async functionality', function () { | |||||
| }); | ||||||
|
|
||||||
| it('should handle zero and negative timeouts', async function () { | ||||||
| // Skip this test on Node.js < 18.20.0: AbortSignal.timeout() was added in 17.3.0, | ||||||
| // but support for zero timeout values was only fixed in | ||||||
| // 18.20.0 (prior versions throw RangeError for AbortSignal.timeout(0)) | ||||||
| const [major, minor] = process.versions.node.split('.').map(Number); | ||||||
|
||||||
| const [major, minor] = process.versions.node.split('.').map(Number); | |
| const [major, minor] = process.versions.node.split('.').slice(0, 2).map(Number); |
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.
Node.js 16.X reached end-of-life in September 2023 and is no longer receiving security updates. While testing on older versions may be valuable for backward compatibility, consider also testing on a supported version (18.X or 20.X) to ensure the polyfill works correctly on both old and new versions. The x64 workflow tests on 24.X and 25.X, creating a large version gap in test coverage.