power-assert-js/power-assert

Does this work with substack/tape?

dbkaplun opened this issue · 5 comments

Does this work with substack/tape?

Short Answer: Sorry, No.

Not yet. Once we've tried to and suspened for a while.

added to FAQ then closed.
Thank you for your question.

Can you expand on this a bit, please? The README says that you can simply ‘use assert instead’ (i.e. not run your code through the power-assert module); wouldn't that mean that TAP is implicitly supported?

How, precisely, is TAP output not possible with power-assert?

@ELLIOTTCABLE

Tape actually wraps Node's assertions directly, to something along the lines of this:

// Obviously, it's a lot more sophisticated than this, because
// assertion messages need printed, etc.
var assert = require("assert")
Object.keys(assert).forEach(function (key) {
  Test.prototype[key] = function () {
    try {
      assert[key].apply(assert, arguments)
    } catch (e) {
      this.fail(e.message)
      return
    }
    this.pass()
  }
})

Because it wraps Node's native methods from directly requiring them internally, and it does not catch and report thrown errors, there's no way to support it without either the user using tape-catch or power-assert reinventing much of that and/or Tape's test handling magic.

Hi, is anything changed regarding to this? :)