Closed cappslock closed 8 years ago
Hey. Absolutely. I've already made the necessary accommodations, but haven't disabled Object.prototype.must
by default because of backwards compatibility. It'll be optional in v1, but till then you can either just delete Object.prototype.must
in your test/index.js
and load it with mocha.opts
(https://github.com/moll/js-must#autoloading) or load the must.js
file directly: require("must/must")
. The latter doesn't "register" the global even in <v1. The default is must/register
.
I updated the other examples in the README to use must/register
to future-proof people new to Must.js. ;-)
Wonderful, thank you!
Fun fact, I'm not even using this for testing currently, just verifying arguments and preconditions in functions to prevent pernicious bugs.
Hehe, indeed, I've thought about how to make Must more amenable to use outside of testing, too.
I'm leaning towards we're just using an overly weak language and should look for more type-safe languages to save a bunch of effort doing runtime checks. ^_^
I'll close this issue for now, though we can carry on conversing. ;)
Would you consider reopening this until this is implemented?
Mainly so that, when you close it, I know I can switch to Must :)
I like using the
demand()
syntax style and would prefer not to modify the prototype chain of language primitives. Unfortunately there's no way to do this with must currently, which is a deal-breaker for me.Would you consider offering a version of this which can be used in the
demand(thing).to.be.true()
which does not still enable thething.must.be.true()
syntax? Chai seems to be able to do this, but I'd prefer to use must for the reasons you already know about :)