juliemr / minijasminenode

A very bare-bones version of jasmine-node
MIT License
32 stars 21 forks source link

adds because() clause #11

Closed kfishkin closed 10 years ago

kfishkin commented 10 years ago

This adds custom error message capability. The usage is that you can do because(whatever).expect(a).toBe(b)

if the expectation fails, then 'whatever' is prepended to the error message. This is handy when trying to disambiguate between varying error messages, or unclear ones. For example, because(string1).expect(string1.indexOf('x')).toEqual(-1) would now print string 1, instead of just saying "expected 3 to equal -1"

juliemr commented 10 years ago

Thanks! Merged as fd788b0aa6b87dc426075e0fbe48afe621df9043

I'm going to check this out with Protractor and make sure everything's smooth once the webdriver adapter gets added, and then can cut a new release of minijasminenode.