xref: /third_party/node/test/parallel/test-repl-pretty-stack-custom-writer.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst { PassThrough } = require('stream');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst repl = require('repl');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci{
81cb0ef41Sopenharmony_ci  const input = new PassThrough();
91cb0ef41Sopenharmony_ci  const output = new PassThrough();
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci  const r = repl.start({
121cb0ef41Sopenharmony_ci    prompt: '',
131cb0ef41Sopenharmony_ci    input,
141cb0ef41Sopenharmony_ci    output,
151cb0ef41Sopenharmony_ci    writer: String,
161cb0ef41Sopenharmony_ci    terminal: false,
171cb0ef41Sopenharmony_ci    useColors: false
181cb0ef41Sopenharmony_ci  });
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci  r.write('throw new Error("foo[a]")\n');
211cb0ef41Sopenharmony_ci  r.close();
221cb0ef41Sopenharmony_ci  assert.strictEqual(output.read().toString(), 'Uncaught Error: foo[a]\n');
231cb0ef41Sopenharmony_ci}
24

Indexes created Thu Nov 07 10:32:03 CST 2024