File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,23 @@ const assert = require('assert');
99const channel = dc.tracingChannel('test');
1010const store = new AsyncLocalStorage();
1111
12- const context = { foo: 'bar' };
12+ const firstContext = { foo: 'bar' };
13+ const secondContext = { baz: 'buz' };
1314
1415channel.start.bindStore(store, common.mustCall(() => {
15- return context;
16+ return firstContext;
17+ }));
18+
19+ channel.asyncStart.bindStore(store, common.mustNotCall(() => {
20+ return secondContext;
1621}));
1722
1823assert.strictEqual(store.getStore(), undefined);
1924channel.tracePromise(common.mustCall(async () => {
20- assert.deepStrictEqual(store.getStore(), context );
25+ assert.deepStrictEqual(store.getStore(), firstContext );
2126 await setTimeout(1);
22- assert.deepStrictEqual(store.getStore(), context);
27+ // Should _not_ switch to second context as promises don't have an "after"
28+ // point at which to do a runStores.
29+ assert.deepStrictEqual(store.getStore(), firstContext);
2330}));
2431assert.strictEqual(store.getStore(), undefined);
You can’t perform that action at this time.
0 commit comments