node
node copied to clipboard
docs(test-runner): missing example and explain about how to mock error
Affected URL(s)
https://nodejs.org/docs/latest-v20.x/api/test.html#mocking
Description of the problem
On docs there missing explains about how to mock Error and catch it with throws.
You haven't provided enough information for a meaningful bug report. You're creating a mock, but not showing where/how you expect that mock to be triggered. I'm guessing it's supposed to be somewhere in getBitness(), but that code is not provided.
You haven't provided enough information for a meaningful bug report. You're creating a mock, but not showing where/how you expect that mock to be triggered. I'm guessing it's supposed to be somewhere in getBitness(), but that code is not provided.
I had remove my code snippet because it's isn't right. And real subject of this issue is example of mocking Error with nod test-runner.
The docs can be improved, but until then, here are a couple examples in the tests.
How to work on docs? I would like to work on this issue.
The docs for the test runner are in doc/api/test.md.
ok thanks !
Is this issue still relevant? If so I'd like to give it a try