Skip to content

feat: allow spy warning and return emitted state - #144

Merged
jean-michelet merged 4 commits into
mainfrom
feat/spy
Jul 30, 2026
Merged

feat: allow spy warning and return emitted state#144
jean-michelet merged 4 commits into
mainfrom
feat/spy

Conversation

@climba03003

Copy link
Copy Markdown
Member

Fixes fastify/fastify#6878

  1. Return the current emitted state when warning is called.
  2. Allows spy the warning

No performance is dropped for adding the spy feature.

# Feature Branch
process-warning> node .\benchmarks\warn.js
warn x 188,557,324 ops/sec ±3.67% (89 runs sampled)
(node:36000) [TST_ERROR_CODE_1] TestWarning: message
(Use `node --trace-warnings ...` to show where the warning was created)
(node:36000) [TST_ERROR_CODE_2] TestWarning: message

# Main Branch
process-warning> node .\benchmarks\warn.js
warn x 185,718,346 ops/sec ±3.11% (86 runs sampled)
(node:39960) [TST_ERROR_CODE_1] TestWarning: message
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39960) [TST_ERROR_CODE_2] TestWarning: message

Checklist

@climba03003
climba03003 requested a review from a team July 29, 2026 12:57
Comment thread index.js Outdated
@climba03003
climba03003 requested a review from Tony133 July 29, 2026 14:01

@Tony133 Tony133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Comment thread README.md
@Tony133
Tony133 requested a review from Fdawgs July 29, 2026 14:39
@jean-michelet
jean-michelet merged commit 11c73b6 into main Jul 30, 2026
17 checks passed
@jean-michelet
jean-michelet deleted the feat/spy branch July 30, 2026 10:02
@Fdawgs

Fdawgs commented Jul 30, 2026

Copy link
Copy Markdown
Member

Why ping me then merge before I could get to it @jean-michelet ? 😄

@jean-michelet

Copy link
Copy Markdown
Member

Because Metcoder and Tony accepted, and it is mainly used by us in core so I tough it was ok.
Sorry ^^

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.

Add a warning spy utility for Fastify tests

5 participants