11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciif (process.argv[2] === 'async') { 61cb0ef41Sopenharmony_ci async function fn() { 71cb0ef41Sopenharmony_ci fn(); 81cb0ef41Sopenharmony_ci throw new Error(); 91cb0ef41Sopenharmony_ci } 101cb0ef41Sopenharmony_ci return (async function() { await fn(); })(); 111cb0ef41Sopenharmony_ci} 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst assert = require('assert'); 141cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process'); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciconst ret = spawnSync( 171cb0ef41Sopenharmony_ci process.execPath, 181cb0ef41Sopenharmony_ci ['--unhandled-rejections=none', '--stack_size=150', __filename, 'async'], 191cb0ef41Sopenharmony_ci { maxBuffer: Infinity } 201cb0ef41Sopenharmony_ci); 211cb0ef41Sopenharmony_ciassert.strictEqual(ret.status, 0, 221cb0ef41Sopenharmony_ci `EXIT CODE: ${ret.status}, STDERR:\n${ret.stderr}`); 231cb0ef41Sopenharmony_ciconst stderr = ret.stderr.toString('utf8', 0, 2048); 241cb0ef41Sopenharmony_ciassert.doesNotMatch(stderr, /async.*hook/i); 251cb0ef41Sopenharmony_ciassert.ok(stderr.includes('Maximum call stack size exceeded'), stderr); 26