Add 'throws'/'notThrows' assertion to Ospec for error reporting (#2255)
* Ospec: added assertion that function does/doesnt throw error * Ospec.throws passes npm test * Ospec.throws: Address requested changes * Ospec: message comparison support for .throws/.notthrows Credit to @maranomynet, #2227
This commit is contained in:
parent
22427db882
commit
0fd1bc9cae
4 changed files with 40 additions and 1 deletions
|
|
@ -429,7 +429,7 @@ If an argument is defined for the `assertions` function, the test is deemed to b
|
|||
|
||||
### Assertion o(any value)
|
||||
|
||||
Starts an assertion. There are four types of assertion: `equals`, `notEquals`, `deepEquals` and `notDeepEquals`.
|
||||
Starts an assertion. There are six types of assertion: `equals`, `notEquals`, `deepEquals`, `notDeepEquals`, `throws`, `notThrows`.
|
||||
|
||||
Assertions have this form:
|
||||
|
||||
|
|
@ -467,6 +467,22 @@ Asserts that two values are recursively equal
|
|||
|
||||
Asserts that two values are not recursively equal
|
||||
|
||||
#### Function(String description) o(Function fn).throws(Object constructor)
|
||||
|
||||
Asserts that a function throws an instance of the provided constructo
|
||||
|
||||
#### Function(String description) o(Function fn).throws(String message)
|
||||
|
||||
Asserts that a function throws an Error with the provided message
|
||||
|
||||
#### Function(String description) o(Function fn).notThrows(Object constructor)
|
||||
|
||||
Asserts that a function does not throw an instance of the provided constructor
|
||||
|
||||
#### Function(String description) o(Function fn).notThrows(String message)
|
||||
|
||||
Asserts that a function does not throw an Error with the provided message
|
||||
|
||||
---
|
||||
|
||||
### void o.before(Function([Function done [, Function timeout]]) setup)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue