slagyr / speclj

pronounced "speckle": a TDD/BDD framework for Clojure.
MIT License
459 stars 58 forks source link

Improve Error report #99

Closed mike-thompson-day8 closed 10 years ago

mike-thompson-day8 commented 10 years ago

I got this message when using clojurescript:

Uncaught Error: No protocol method SpecComponent.install defined for type null:  test.js:1529
cljs.core.missing_protocol test.js:1529
speclj.components.install

It took me waaaaaay too long to realise that it was because I'd mucked up some parens in my describes.

To help hapless fools such as myself, could I suggest that you extend "null" so that it gives you a more useful message about messing up your tests: https://github.com/slagyr/speclj/blob/master/src/cljx/speclj/components.cljx#L21 A bit like nil is extended for clj (a few lines above).

I'm thinking of something like this:

null (install [this description] (throw (str "Oops!  It looks like you tried to add 'null' to a spec.  That's probably a sign of something wrong in your describes"))))
slagyr commented 10 years ago

Ah. Another nice catch. 3.1.0 will include helpful errors for adding nil to a spec.