nodeunit icon indicating copy to clipboard operation
nodeunit copied to clipboard

Inject custom assertions to types.js by publishing assert in types.js

Open ronnen opened this issue 12 years ago • 1 comments

I would like to add custom assertion so it can be used similarly to test.equal (e.g. test.contains).

The issue is that assert is required in two places: In nodeunit.js, and in types.js.

The assert in nodeunit is exported, the one in type is not. If this could be exposed then it would be very easy to add a custom assert and let the mechanism add them to test with the necessary wrapAssert. Without it, it's still possible to use custom assert but cannot add them to the test level.

Thanks.

Ronnen

ronnen avatar Jun 12 '13 09:06 ronnen

Related to this, it would be interesting to know what the policy is towards assertions in general: do you plan on adding more, or are we to make do with the existing ones?

I would like a test.contains, too, but if it clashes with your ideas I will keep using test.ok(arr.indexOf(val) !== -1).

hypesystem avatar Aug 12 '14 13:08 hypesystem