From 7ecc84c41e950484f35ef142abf064148e31ffce Mon Sep 17 00:00:00 2001 From: m-r-r Date: Tue, 4 May 2021 21:11:26 +0200 Subject: [PATCH] [readme] Update the documention for `t.doesNotThrow()` --- readme.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.markdown b/readme.markdown index b1366954..4c52cead 100644 --- a/readme.markdown +++ b/readme.markdown @@ -336,9 +336,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.