Skip to content

Commit

Permalink
test: eventemmiter asyncresource throw invalid this
Browse files Browse the repository at this point in the history
  • Loading branch information
kuriyosh committed Feb 18, 2022
1 parent 82f6b0c commit 12f4025
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/parallel/test-eventemitter-asyncresource.js
Expand Up @@ -10,6 +10,7 @@ const {
const {
deepStrictEqual,
strictEqual,
throws
} = require('assert');

const {
Expand Down Expand Up @@ -130,3 +131,46 @@ function makeHook(trackedTypes) {
],
]));
})().then(common.mustCall());

// Member methods ERR_INVALID_THIS
{
throws(
() => {
EventEmitterAsyncResource.prototype.emit();
},
{
code: 'ERR_INVALID_THIS',
}
);

throws(
() => {
EventEmitterAsyncResource.prototype.emitDestroy();
},
{
code: 'ERR_INVALID_THIS',
}
);

throws(
() => Reflect.get(EventEmitterAsyncResource.prototype, 'asyncId', {}),
{
code: 'ERR_INVALID_THIS',
}
);

throws(
() =>
Reflect.get(EventEmitterAsyncResource.prototype, 'triggerAsyncId', {}),
{
code: 'ERR_INVALID_THIS',
}
);

throws(
() => Reflect.get(EventEmitterAsyncResource.prototype, 'asyncResource', {}),
{
code: 'ERR_INVALID_THIS',
}
);
}

0 comments on commit 12f4025

Please sign in to comment.