Skip to content

Commit 4b4336c

Browse files
Stephen BelangerRafaelGSS
Stephen Belanger
authored andcommitted
test: verify tracePromise does not do runStores
PR-URL: #47349 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent d243115 commit 4b4336c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/parallel/test-diagnostics-channel-tracing-channel-promise-run-stores.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ const assert = require('assert');
99
const channel = dc.tracingChannel('test');
1010
const store = new AsyncLocalStorage();
1111

12-
const context = { foo: 'bar' };
12+
const firstContext = { foo: 'bar' };
13+
const secondContext = { baz: 'buz' };
1314

1415
channel.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

1823
assert.strictEqual(store.getStore(), undefined);
1924
channel.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
}));
2431
assert.strictEqual(store.getStore(), undefined);

0 commit comments

Comments
 (0)