xref: /third_party/node/test/parallel/test-repl-null-thrown.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 repl = require('repl');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst Stream = require('stream');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst output = new Stream();
81cb0ef41Sopenharmony_cilet text = '';
91cb0ef41Sopenharmony_cioutput.write = output.pause = output.resume = function(buf) {
101cb0ef41Sopenharmony_ci  text += buf.toString();
111cb0ef41Sopenharmony_ci};
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst replserver = repl.start({
141cb0ef41Sopenharmony_ci  output: output,
151cb0ef41Sopenharmony_ci  input: process.stdin
161cb0ef41Sopenharmony_ci});
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cireplserver.emit('line', 'process.nextTick(() => { throw null; })');
191cb0ef41Sopenharmony_cireplserver.emit('line', '.exit');
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_cisetTimeout(() => {
221cb0ef41Sopenharmony_ci  console.log(text);
231cb0ef41Sopenharmony_ci  assert(text.includes('Uncaught null'));
241cb0ef41Sopenharmony_ci}, 0);
25

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