11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst { AsyncLocalStorage } = require('async_hooks'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst asyncLocalStorage = new AsyncLocalStorage(); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciasync function test() { 91cb0ef41Sopenharmony_ci asyncLocalStorage.getStore().set('foo', 'bar'); 101cb0ef41Sopenharmony_ci await Promise.resolve(); 111cb0ef41Sopenharmony_ci assert.strictEqual(asyncLocalStorage.getStore().get('foo'), 'bar'); 121cb0ef41Sopenharmony_ci} 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciasync function main() { 151cb0ef41Sopenharmony_ci await asyncLocalStorage.run(new Map(), test); 161cb0ef41Sopenharmony_ci assert.strictEqual(asyncLocalStorage.getStore(), undefined); 171cb0ef41Sopenharmony_ci} 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_cimain(); 20