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