1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4const repl = require('repl'); 5const { PassThrough } = require('stream'); 6const input = new PassThrough(); 7const output = new PassThrough(); 8 9const r = repl.start({ 10 input, output, 11 eval: common.mustCall((code, context, filename, cb) => { 12 r.setPrompt('prompt! '); 13 cb(new Error('err')); 14 }) 15}); 16 17input.end('foo\n'); 18 19// The output includes exactly one post-error prompt. 20const out = output.read().toString(); 21assert.match(out, /prompt!/); 22assert.doesNotMatch(out, /prompt![\S\s]*prompt!/); 23output.on('data', common.mustNotCall()); 24