Search code examples
node.jstestingnode.js-tape

Callback when test fails with tape


Is it a way to call a function in case of error?

I have a test like that:

t.true(ARRAY.every(function(item){
    return item.label
}), 'Every item should have label')

So I am looking for a callback to specify which item hasn't label in case of failing.


Solution

  • Someone gave me an alternative on the tape github:

    every is for when you want to reduce an array to a boolean, which isn't appropriate for testing (and getting a meaningful failure message) every item in an array.

    Tape issue