node/test/parallel/test-repl-null-thrown.js
Ruben Bridgewater 6c40cb2aca
repl: use better uncaught exceptions indicator
This switches "Thrown:" with "Uncaught" to outline clearer that the
thrown error is not caught.

PR-URL: https://github.com/nodejs/node/pull/29676
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-12-06 02:10:58 +01:00

25 lines
541 B
JavaScript

'use strict';
require('../common');
const repl = require('repl');
const assert = require('assert');
const Stream = require('stream');
const output = new Stream();
let text = '';
output.write = output.pause = output.resume = function(buf) {
text += buf.toString();
};
const replserver = repl.start({
output: output,
input: process.stdin
});
replserver.emit('line', 'process.nextTick(() => { throw null; })');
replserver.emit('line', '.exit');
setTimeout(() => {
console.log(text);
assert(text.includes('Uncaught null'));
}, 0);