Skip to content

Commit 1f3bc5e

Browse files
Trottdanielleadams
authored andcommitted
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: #36624 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent f623d5d commit 1f3bc5e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
// Test that passing thisArg to runInAsyncScope() works.
4+
5+
const common = require('../common');
6+
const assert = require('assert');
7+
const { AsyncResource } = require('async_hooks');
8+
9+
const thisArg = {};
10+
11+
const res = new AsyncResource('fhqwhgads');
12+
13+
function callback() {
14+
assert.strictEqual(this, thisArg);
15+
}
16+
17+
res.runInAsyncScope(common.mustCall(callback), thisArg);

0 commit comments

Comments
 (0)