1'use strict'; 2require('../common'); 3const repl = require('repl'); 4const assert = require('assert'); 5const Stream = require('stream'); 6 7const output = new Stream(); 8let text = ''; 9output.write = output.pause = output.resume = function(buf) { 10 text += buf.toString(); 11}; 12 13const replserver = repl.start({ 14 output: output, 15 input: process.stdin 16}); 17 18replserver.emit('line', 'process.nextTick(() => { throw null; })'); 19replserver.emit('line', '.exit'); 20 21setTimeout(() => { 22 console.log(text); 23 assert(text.includes('Uncaught null')); 24}, 0); 25