Skip to content

types: expose PendingInterceptor and PendingInterceptorsFormatter on the MockAgent namespace - #5721

Merged
mcollina merged 1 commit into
nodejs:mainfrom
RaphaelFakhri:types/export-pending-interceptor
Sep 2, 2026
Merged

types: expose PendingInterceptor and PendingInterceptorsFormatter on the MockAgent namespace#5721
mcollina merged 1 commit into
nodejs:mainfrom
RaphaelFakhri:types/export-pending-interceptor

Conversation

@RaphaelFakhri

@RaphaelFakhri RaphaelFakhri commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #5563.

Both interfaces are declared at the top level of types/mock-agent.d.ts and never exported, so a consumer writing a helper around pendingInterceptors(), or a custom pendingInterceptorsFormatter, has no way to name the argument type and ends up copying the declaration into their own code, where it then drifts from this one.

They move into the MockAgent namespace, next to Options and the other public members, and the two class members now point at the namespaced names. Nothing else in types/ or index.d.ts referenced them, so this is additive for consumers and a no-op for the existing declarations.

test/types/mock-agent.test-d.ts gains an assertion that both names are reachable as MockAgent.PendingInterceptor and MockAgent.PendingInterceptorsFormatter from outside the module.

…m MockAgent

Both interfaces were declared at the top level of the module and never
exported, so a consumer typing a helper around pendingInterceptors() had no way
to name their argument and had to copy the declaration, which then drifts.
Move them under the MockAgent namespace and point the two members at the
namespaced names.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.46%. Comparing base (fc3450d) to head (ae24422).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5721      +/-   ##
==========================================
- Coverage   93.47%   93.46%   -0.02%     
==========================================
  Files         110      110              
  Lines       38908    38908              
==========================================
- Hits        36368    36364       -4     
- Misses       2540     2544       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina
mcollina merged commit a7fcd7b into nodejs:main Sep 2, 2026
33 of 38 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 4, 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.

d.ts: Export PendingInterceptor type from mock-agent.d.ts

4 participants