• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const { AsyncLocalStorage } = require('async_hooks');
5const dc = require('diagnostics_channel');
6const assert = require('assert');
7
8const channel = dc.tracingChannel('test');
9const store = new AsyncLocalStorage();
10
11const context = { foo: 'bar' };
12
13channel.start.bindStore(store, common.mustCall(() => {
14  return context;
15}));
16
17assert.strictEqual(store.getStore(), undefined);
18channel.traceSync(common.mustCall(() => {
19  assert.deepStrictEqual(store.getStore(), context);
20}));
21assert.strictEqual(store.getStore(), undefined);
22