We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49364b0 commit 4244080Copy full SHA for 4244080
test/parallel/test-readline-interface.js
@@ -561,15 +561,20 @@ function isWarned(emitter) {
561
{ input: fi, output: fi, terminal: true }
562
);
563
const keys = [];
564
+ const err = new Error('bad thing happened');
565
fi.on('keypress', function(key) {
566
keys.push(key);
567
if (key === 'X') {
- throw new Error('bad thing happened');
568
+ throw err;
569
}
570
});
- try {
571
- fi.emit('data', 'fooX');
572
- } catch { }
+ assert.throws(
+ () => fi.emit('data', 'fooX'),
573
+ (e) => {
574
+ assert.strictEqual(e, err);
575
+ return true;
576
+ }
577
+ );
578
fi.emit('data', 'bar');
579
assert.strictEqual(keys.join(''), 'fooXbar');
580
rli.close();
0 commit comments