11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst { AsyncLocalStorage } = require('async_hooks'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst als = new AsyncLocalStorage(); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci// Make sure _propagate function exists. 91cb0ef41Sopenharmony_ciassert.ok(typeof als._propagate === 'function'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci// The als instance should be getting removed from the storageList in 121cb0ef41Sopenharmony_ci// lib/async_hooks.js when exit(...) is called, therefore when the nested runs 131cb0ef41Sopenharmony_ci// are called there should be no copy of the als in the storageList to run the 141cb0ef41Sopenharmony_ci// _propagate method on. 151cb0ef41Sopenharmony_cials._propagate = common.mustNotCall('_propagate() should not be called'); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciconst done = common.mustCall(); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_cifunction run(count) { 201cb0ef41Sopenharmony_ci if (count === 0) return done(); 211cb0ef41Sopenharmony_ci als.run({}, () => { 221cb0ef41Sopenharmony_ci als.exit(run, --count); 231cb0ef41Sopenharmony_ci }); 241cb0ef41Sopenharmony_ci} 251cb0ef41Sopenharmony_cirun(100); 26