-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fail() method to Should and Expect interfaces #356
Conversation
@@ -21,7 +21,7 @@ | |||
}, | |||
"main": "./index", | |||
"scripts": { | |||
"test": "make test" | |||
"test": "mocha --require ./test/bootstrap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an extraneous change. Could you rebase it out please?
Some good work so far @Soviut. Couple of notes above which I'd like to see addressed - if you could be so kind. Also, as you've noted in the code, it'd be great to get some documentation put in here too 😄 |
if (msg) flag(this, 'message', msg); | ||
var obj = flag(this, 'object'); | ||
throw new chai.AssertionError(msg, {}, obj); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another point to make here; for API consistency I think should.fail
and expect.fail
should work exactly the same as assert.fail
. Method signature and all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the consistency. I chose this route because I was trying to be consistent with the interface. Namely, that values are usually passed along the chain with expect
. I'll try reworking it.
@keithamus There is now an |
Looks fantastic @Soviut. Could you add a little bit of documentation above each of the methods in the code? This way it'll get carried over onto the site documentation when the site is regenerated. |
Will do. |
@keithamus documentation added. I basically just copied what was already in the |
Perfect. Consider it merged 👍 |
Added fail() method to Should and Expect interfaces
Sorry for bothering you, but I can't manage to find the docs for this... |
@sieira the website is outdated right now. We're working on it. chaijs/chaijs.github.io#74 |
Should and Expect now have
fail()
methods like Assert does.Please pay special attention to the Expect implementation as I wasn't totally certain how all of it worked. It may not be fully chainable, though it's not really intended to be.