Skip to content

Comments

doc: add example for mocking functions that throw errors#61939

Open
jorgitin02 wants to merge 1 commit intonodejs:mainfrom
jorgitin02:docs/52357-test-runner-mock-error-example
Open

doc: add example for mocking functions that throw errors#61939
jorgitin02 wants to merge 1 commit intonodejs:mainfrom
jorgitin02:docs/52357-test-runner-mock-error-example

Conversation

@jorgitin02
Copy link

doc: add example for mocking functions that throw errors

Add ESM and CJS examples showing how to mock functions that throw errors
and assert using assert.throws(). Demonstrates inspecting call.error.

Fixes: #52357

Add documentation example showing how to mock functions that throw errors
and assert those errors using assert.throws(). Includes both ESM and
CommonJS examples demonstrating how to inspect the call.error property.

Fixes: nodejs#52357
Signed-off-by: jorge guerrero <grrr.jrg@gmail.com>
@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 Feb 22, 2026
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