Logo
Explore Help
Sign In
1berry/nodejs
1
0
Fork 0
You've already forked nodejs
Code Issues Packages Projects Releases Wiki Activity
nodejs/test/parallel/test-repl-pretty-stack-custom-writer.js

24 lines
484 B
JavaScript
Raw Permalink Normal View History

repl: fix error message printing The REPL implementation would strip away the first and last character of a formatted error message if it ended with `]` (but with the obviously missing check for a starting `]`), leading to things like `Uncaught rror: foo[a` being printed for input like `Error: foo[a]`. Refs: https://github.com/nodejs/node/pull/22436 PR-URL: https://github.com/nodejs/node/pull/38209 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-04-12 11:42:54 +02:00
'use strict';
require('../common');
const { PassThrough } = require('stream');
const assert = require('assert');
const repl = require('repl');
{
const input = new PassThrough();
const output = new PassThrough();
const r = repl.start({
prompt: '',
input,
output,
writer: String,
terminal: false,
useColors: false
});
r.write('throw new Error("foo[a]")\n');
r.close();
assert.strictEqual(output.read().toString(), 'Uncaught Error: foo[a]\n');
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 3336ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API