Skip to content

feat: allow plugins to register additional unhandledRejection filters - #1317

Closed
Pavelgq wants to merge 1 commit into
gemini-testing:masterfrom
Pavelgq:feat/registrable-unhandled-rejection-filter
Closed

feat: allow plugins to register additional unhandledRejection filters#1317
Pavelgq wants to merge 1 commit into
gemini-testing:masterfrom
Pavelgq:feat/registrable-unhandled-rejection-filter

Conversation

@Pavelgq

@Pavelgq Pavelgq commented Aug 22, 2026

Copy link
Copy Markdown

What's done?

Context:

  • Any unhandled rejection in a worker terminates the whole run (fix: handle unhandled rejections #744) — a safety net for tests missing an await
  • shouldIgnoreUnhandledRejection already carves out an exception for known Puppeteer/CDP noise, but it's a hardcoded, closed list
  • Ran into a case where a plugin (not an actual test) triggers an unrelated async rejection while just reading a file for its own config, before any test even starts — same blanket policy kills the whole run for that too, with no way to tell Testplane "this one's fine"

This adds registerUnhandledRejectionFilter(filter) (exposed via testplane/unstable) so a plugin or integration can register its own predicate for cases like that, instead of it needing to get hardcoded into core the way Puppeteer's was:

import { registerUnhandledRejectionFilter } from "testplane/unstable";

const unregister = registerUnhandledRejectionFilter(err => isKnownSafeToIgnore(err));

A filter can only ever make something get ignored, never the reverse, and a filter that throws is just treated as "no match" and logged, so a broken filter can't hide a real error. The built-in Puppeteer allowlist still takes priority. Default behavior is unchanged for everyone who doesn't use this.

How I tested?

Unit tests covering filter registration/unregistration, multiple filters, a throwing filter not breaking anything else, and the built-in Puppeteer allowlist still taking priority. Full existing suite is still green.

@Pavelgq Pavelgq closed this by deleting the head repository Aug 23, 2026
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.

1 participant