onFailure.js 529 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var tap = require('tap');
  3. var tape = require('../').createHarness();
  4. // Because this test passing depends on a failure,
  5. // we must direct the failing output of the inner test
  6. var noop = function () {};
  7. var mockSink = { on: noop, removeListener: noop, emit: noop, end: noop };
  8. tape.createStream().pipe(mockSink);
  9. tap.test('on failure', { timeout: 1000 }, function (tt) {
  10. tt.plan(1);
  11. tape('dummy test', function (t) {
  12. t.fail();
  13. t.end();
  14. });
  15. tape.onFailure(function () {
  16. tt.pass('tape ended');
  17. });
  18. });