How to fail() a test?
Open
- Dominant language
- JavaScript
- Stars
- 1.9k
- Forks
- 359
- PR merge metrics
- No merged PRs in 30d
Description
I hate myself when I want to end a test and the only solution coming to my mind is:
```
foo(err) {
if (err) {
test.ok(false, 'error in foo, test finished');
test.done();
}
}
```
Would be useful some kind of `test.fail(error)` method? do I miss something?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading nodeunit's existing test.ok and test.done APIs, which the issue uses as the current workaround. Determine how a test.fail(error) entry point should report the error and finish the test; done should be covered by tests for the proposed failure behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100