Skip to content

Conversation

@rish106-hub
Copy link

Fixes #52357

Added documentation and examples showing how to mock functions that throw errors and test them using assert.throws().

This addresses the missing explanation in the test runner mocking documentation about how to mock errors and catch them with throws.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. test_runner Issues and PRs related to the test runner subsystem. labels Nov 13, 2025
@JakobJingleheimer
Copy link
Member

Hiya! Thanks for putting this together, but I think it's not really necessary. If anything, I think it would be more appropriate in the learn article: https://nodejs.org/learn/en/test-runner/mocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(test-runner): missing example and explain about how to mock error

3 participants