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
Lines changed: 17 additions & 0 deletions
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+
constcommon=require('../common');
6+
constassert=require('assert');
7+
const{ AsyncResource }=require('async_hooks');
8+
9+
constthisArg={};
10+
11+
constres=newAsyncResource('fhqwhgads');
12+
13+
functioncallback(){
14+
assert.strictEqual(this,thisArg);
15+
}
16+
17+
res.runInAsyncScope(common.mustCall(callback),thisArg);

0 commit comments

Comments
(0)