Commit activity
Last 12 weeks · 31 commits
Community health
4 of 6 standards met
Recent PRs & issues
Since 10.0.0, constructing a in a Jest test that uses the jsdom environment throws: I'm not sure this should be considered a bug, since it comes from how the test environment mixes Node and jsdom. I'm posting it partially in case others run into it, with a workaround and a possible fix below. Reproduction p-queue 10.0.0, Jest 30.5 with 30.5, Node 24.19. Works in plain Node and in browsers. Not tested under Vitest. Cause The constructor does: Under Jest's jsdom environment: exists, because Jest installs a copy of Node's real (including ) in every environment, jsdom included. So this returns Node's real module. (which extends) is jsdom's class, not Node's. Node's only accepts its own instances, so it throws. Possible fix within p-queue Wrap the call in a /. The call only silences a warning, so skipping it when the target isn't one of Node's own s seems harmless. Workaround In a Jest script, mark jsdom's as one of Node's own: This relies on an undocumented Node internal (the symbol Node uses to recognize its own s). Thank you.
Adds , the missing sibling of : tasks gained an and can be re-ranked, but nothing public can remove one — today removal requires threading an into every ahead of time. Semantics: Removes every QUEUED (not-yet-started) task whose matches; returns the count removed ( for an unknown id, no effect). Each removed task's promise rejects with the new exported (naming the id), and its function is never invoked — no forever-pending promises leaked. Running tasks are never touched; stopping started work remains the 's job (the doc says so). and size-derived observers (, , ) see the change immediately; , intervals, and concurrency bookkeeping are unaffected. Internally the removal settles through the same path as a queued-task abort, so there's no second bookkeeping route to drift. Includes node:test coverage (206 → 216 passing) for multi-match removal, unknown ids, promise settlement, running-task survival, and interplay, plus tsd type coverage and a readme entry beside . Full disclosure: this change was implemented end-to-end by Detent, an autonomous-engineering tool I'm building — every step gated by this repo's own test chain (xo, node:test, tsc, tsd) and independently reviewed before commit. Happy to adjust anything, or to close this in favor of an issue discussion if you prefer that flow. 🤖 Generated with Claude Code A complete implementation (206 → 216 tests green through xo/node:test/tsc/tsd) is ready on — GitHub's interaction limits currently prevent me from opening the PR directly; happy to open it the moment that clears, or for a maintainer to pull the branch.
Recent fixes
With npm / Node 24.14.1, cancellation is missed if the task aborts its signal synchronously before returning a pending operation: Actual before releasing the operation: . Expected: the promise rejects and releases its slot, as it does if the same abort is scheduled in a microtask. This does not require stopping the operation itself; the example releases it explicitly. The running abort listener is installed after calling the task. does not replay the earlier event. Checking after registration fixes this without changing the existing promise race or task-error precedence. Tested patch: commit c9f9c7d. The regression fails on unchanged source. All 208 Windows runtime tests, and pass. A paired compiled-JS probe on Windows/Node24.14.1 and Linux/Node24.19.0 covers synchronous callback abort, async-prefix abort and thenable-conversion abort; five normal/abort/error controls remain unchanged. Full Linux/Node20 CI is not verified. Lint currently reports the same nine project-service parsing errors on both unchanged and patched source, so I am not claiming passes. PR creation remains collaborators-only, so this is an issue with a tested patch. AI-assisted analysis and implementation; the reported checks were executed.
Repository: sindresorhus/p-queue. Description: Promise queue with concurrency control Stars: 4298, Forks: 226. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Topics: async-functions, async-queue, node-module, npm-package, promise, promise-queue, queue, queue-data-stucture. Latest release: v10.0.0 (1w ago). Open PRs: 2, open issues: 3. Last activity: 5d ago. Community health: 85%. Top contributors: sindresorhus, Richienb, floatdrop, Rafael09ED, onury, ltetzlaff, edorivai, dobesv, BendingBender, bobjflong and others.