Skip to content

Commit

Permalink
fix: Exclude domainEmitter from output (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Dec 6, 2022
1 parent 65e5b6d commit 2a89513
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -10,6 +10,7 @@ var ignored = new Set(
'showProperties',
'showStack',
'domain',
'domainEmitter',
'domainThrown',
])
);
Expand Down
13 changes: 13 additions & 0 deletions test/index.js
Expand Up @@ -252,6 +252,19 @@ describe('PluginError()', function () {
done();
});

it('should not show additional properties added by a domain', function (done) {
var Duplex = require('stream').Duplex;
var stream = new Duplex({ objectMode: true });
var domain = require('domain').create();
domain.add(stream);
domain.on('error', function (err) {
expect(err).toBeInstanceOf(PluginError);
expect(err.toString()).not.toContain('domain');
done();
});
stream.emit('error', new PluginError('plugin', 'message'));
});

it('should not modify error argument', function (done) {
var realErr = { message: 'something broke' };
new PluginError('test', realErr);
Expand Down

0 comments on commit 2a89513

Please sign in to comment.