As Should.js use BDD style of assertions, it suppose to be readable from the code. I am wondering what is the most readable assert.fail() equivalent for should.js. I am missing something like should.fail
.
Asked
Active
Viewed 195 times
1

luboskrnac
- 23,973
- 10
- 81
- 92
3 Answers
2
should.fail exists as a method:
should.fail()

Myk Willis
- 12,306
- 4
- 45
- 62
-
Just tried it, such function without parameters doesn't exist, so it fails, but the message is confusing. – luboskrnac Oct 31 '14 at 20:10
-
Yeah, that's funny. Guess it's not documented (and doesn't work as I thought), yet it always did the trick for me just by blowing up the test. – Myk Willis Oct 31 '14 at 20:25
1
EDITED
How about:
- "This should fail".should.be.true;

cybersam
- 63,203
- 6
- 53
- 76
-
There shouldn't be variables. I meant something that fails when that statement is reached. – luboskrnac Oct 31 '14 at 19:53
-
Still not ideal from readability point of view, but give you upvote. – luboskrnac Oct 31 '14 at 20:15