fantasyland/fantasy-laws

Asserts

Closed this issue · 5 comments

memee commented

jsc.assert(jsc.forall(A, property));

This implementation rather disables tape users from asserting in the way tape lib requires. Like having test plan: t.plan(1) where you declare the number of asserts.

Example:

var test = require('tape');
 
test('timing test', function (t) {
    t.plan(2); // <--- plan
    
    t.equal(typeof Date.now, 'function'); // <--- assert
    var start = Date.now();
    
    setTimeout(function () {
        t.equal(Date.now() - start, 100); // <--- assert
    }, 100);
});

No idea come to my mind that will not turn the implementation upside down.
Any idea of workarounds that will help to use other test frameworks than Mocha?

I'm not familiar with tape, @memee. I'll be happy to consider a proposal to restructure the assertion thunks in order to improve interoperability.

I think you can just nut call the plan and use t.end() when test ends

i have actually done that and works fine https://github.com/safareli/free/blob/master/test/laws.js#L22

That's good to know. Thanks, Irakli. :)

You are welcome!