Skip to content

Commit

Permalink
Clarify doesNotThrow parameters
Browse files Browse the repository at this point in the history
To prevent issues like #334, here is a proposal to clarify the purpose of the second argument. My own first reaction to the second argument was like "Whaaat, the docs cannot be right. Even the mere word 'expected' is against the purpose of the assertion. How we can expect something that is not thrown. The argument cannot have any meaning." Then I browsed through the issues, found #334 and then it became clear.
  • Loading branch information
axelpale committed Nov 25, 2018
1 parent 96de340 commit f53e3f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Assert that the function call `fn()` throws an exception. `expected`, if present

## t.doesNotThrow(fn, expected, msg)

Assert that the function call `fn()` does not throw an exception. `msg` is an optional description of the assertion.
Assert that the function call `fn()` does not throw an exception. `expected`, if present, limits what should not be thrown. For example, set `expected` to `/user/` to fail the test only if the string representation of the exception contains the word `user`. Any other exception would pass the test. If `expected` is omitted, any exception will fail the test. `msg` is an optional description of the assertion.

## t.test(name, [opts], cb)

Expand Down

0 comments on commit f53e3f1

Please sign in to comment.