node icon indicating copy to clipboard operation
node copied to clipboard

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

Open AugustinMauroy opened this issue 1 year ago • 7 comments

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.

AugustinMauroy avatar Apr 03 '24 20:04 AugustinMauroy

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.

cjihrig avatar Apr 03 '24 20:04 cjihrig

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.

AugustinMauroy avatar Apr 03 '24 20:04 AugustinMauroy

The docs can be improved, but until then, here are a couple examples in the tests.

cjihrig avatar Apr 03 '24 20:04 cjihrig

How to work on docs? I would like to work on this issue.

AugustinMauroy avatar Apr 04 '24 06:04 AugustinMauroy

The docs for the test runner are in doc/api/test.md.

cjihrig avatar Apr 04 '24 13:04 cjihrig

ok thanks !

AugustinMauroy avatar Apr 04 '24 17:04 AugustinMauroy

Is this issue still relevant? If so I'd like to give it a try

geeksilva97 avatar Sep 25 '24 00:09 geeksilva97