1'use strict'; 2 3const common = require('../common'); 4 5if (process.argv[2] === 'async') { 6 common.disableCrashOnUnhandledRejection(); 7 async function fn() { 8 fn(); 9 throw new Error(); 10 } 11 return (async function() { await fn(); })(); 12} 13 14const assert = require('assert'); 15const { spawnSync } = require('child_process'); 16 17const ret = spawnSync( 18 process.execPath, 19 ['--stack_size=150', __filename, 'async'], 20 { maxBuffer: Infinity } 21); 22assert.strictEqual(ret.status, 0, 23 `EXIT CODE: ${ret.status}, STDERR:\n${ret.stderr}`); 24const stderr = ret.stderr.toString('utf8', 0, 2048); 25assert.ok(!/async.*hook/i.test(stderr)); 26assert.ok(stderr.includes('Maximum call stack size exceeded'), stderr); 27