test: increase runInAsyncScope() coverage
We don't appear to have any test coverage for passing the `thisArg` argument to `runInAsyncScope()`. Test coverage stats seem to bear this out. Add a test for it. PR-URL: https://github.com/nodejs/node/pull/36624 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
4d3e87da3b
commit
73b8909501
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
// Test that passing thisArg to runInAsyncScope() works.
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { AsyncResource } = require('async_hooks');
|
||||
|
||||
const thisArg = {};
|
||||
|
||||
const res = new AsyncResource('fhqwhgads');
|
||||
|
||||
function callback() {
|
||||
assert.strictEqual(this, thisArg);
|
||||
}
|
||||
|
||||
res.runInAsyncScope(common.mustCall(callback), thisArg);
|
Loading…
x
Reference in New Issue
Block a user