summaryrefslogtreecommitdiff
path: root/test/async-hooks/test-embedder.api.async-resource.runInAsyncScope.js
blob: 627880b4d98b07cffda61737924e2f9ee16cf58f (plain)
1
2
3
4
5
6
7
8
9
10
11
'use strict';
require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');

// Ensure that asyncResource.makeCallback returns the callback return value.
const a = new async_hooks.AsyncResource('foobar');
const ret = a.runInAsyncScope(() => {
  return 1729;
});
assert.strictEqual(ret, 1729);