summaryrefslogtreecommitdiff
path: root/test/parallel/test-async-hooks-run-in-async-scope-this-arg.js
blob: a5016da9d5fcd3a5a9872fa528ed1ce09afb2683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);