11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// This tests a highly specific regression tied to the FixedQueue size, which 61cb0ef41Sopenharmony_ci// was introduced in Node.js 9.7.0: https://github.com/nodejs/node/pull/18617 71cb0ef41Sopenharmony_ci// More specifically, a nextTick list could potentially end up not fully 81cb0ef41Sopenharmony_ci// clearing in one run through if exactly 2048 ticks were added after 91cb0ef41Sopenharmony_ci// microtasks were executed within the nextTick loop. 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciprocess.nextTick(() => { 121cb0ef41Sopenharmony_ci Promise.resolve(1).then(() => { 131cb0ef41Sopenharmony_ci for (let i = 0; i < 2047; i++) 141cb0ef41Sopenharmony_ci process.nextTick(common.mustCall()); 151cb0ef41Sopenharmony_ci const immediate = setImmediate(common.mustNotCall()); 161cb0ef41Sopenharmony_ci process.nextTick(common.mustCall(() => clearImmediate(immediate))); 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci}); 19