mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
73b8909501
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>
18 lines
380 B
JavaScript
18 lines
380 B
JavaScript
'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);
|