Skip to content

Commit

Permalink
Print MaxListenersExceeded warnings as TAP comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed May 24, 2018
1 parent c3e91f9 commit ae8c267
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/check-listener-leaks.js
Expand Up @@ -23,6 +23,14 @@ var common = require('./common');
var assert = require('assert');
var events = require('../');

// Redirect warning output to tape.
var consoleWarn = console.warn;
console.warn = common.test.comment;

common.test.on('end', function () {
console.warn = consoleWarn;
});

// default
{
var e = new events.EventEmitter();
Expand Down
5 changes: 5 additions & 0 deletions tests/index.js
@@ -1,12 +1,17 @@
var test = require('tape');

require('./legacy-compat');
var common = require('./common');

// we do this to easily wrap each file in a mocha test
// and also have browserify be able to statically analyze this file
var orig_require = require;
var require = function(file) {
test(file, function(t) {
// Store the tape object so tests can access it.
t.on('end', function () { delete common.test; });
common.test = t;

try { orig_require(file); } catch (err) { t.fail(err); }
t.end();
});
Expand Down

0 comments on commit ae8c267

Please sign in to comment.