MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-async-local-storage-contexts.js:28–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27const storage = new AsyncLocalStorage();
28async function test() {
29 return storage.run({ test: 'main context' }, common.mustCall(async () => {
30 assert.strictEqual(storage.getStore().test, 'main context');
31 await 42;
32 assert.strictEqual(storage.getStore().test, 'main context');
33 }));
34}
35test();

Calls 2

runMethod · 0.45
getStoreMethod · 0.45

Tested by

no test coverage detected