Skip to content

Commit

Permalink
Update the documention for t.doesNotThrow()
Browse files Browse the repository at this point in the history
  • Loading branch information
m-r-r committed May 4, 2021
1 parent 0e8f19d commit fbb0ac5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,10 @@ Please note that the second parameter, `expected`, cannot be of type `string`. I

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

Assert that the function call `fn()` does not throw an exception. `expected`, if present, limits what should not be thrown, and must be a `RegExp` or `Function`. The `RegExp` matches the string representation of the exception, as generated by `err.toString()`. For example, if you set `expected` to `/user/`, the test will fail only if the string representation of the exception contains the word `user`. Any other exception will result in a passed test. The `Function` is the exception thrown (e.g. `Error`). If `expected` is not of type `RegExp` or `Function`, or omitted entirely, any exception will result in a failed test. `msg` is an optional description of the assertion.
Assert that the function call `fn()` does not throw an exception. `expected`, is ignored unless it is a value of type string. Any exception will result in a failed test. `msg` is an optional description of the assertion.

Please note that the second parameter, `expected`, cannot be of type `string`. If a value of type `string` is provided for `expected`, then `t.doesNotThrows(fn, expected, msg)` will execute, but the value of `expected` will be set to `undefined`, and the specified string will be set as the value for the `msg` parameter (regardless of what _actually_ passed as the third parameter).

Please note that the second parameter, `expected`, cannot be of type `string`. If a value of type `string` is provided for `expected`, then `t.doesNotThrows(fn, expected, msg)` will execute, but the value of `expected` will be set to `undefined`, and the specified string will be set as the value for the `msg` parameter (regardless of what _actually_ passed as the third parameter). This can cause unexpected results, so please be mindful.
## t.test(name, [opts], cb)

Create a subtest with a new test handle `st` from `cb(st)` inside the current test `t`. `cb(st)` will only fire when `t` finishes. Additional tests queued up after `t` will not be run until all subtests finish.
Expand Down

0 comments on commit fbb0ac5

Please sign in to comment.