Skip to content

Commit

Permalink
test: add repl preview timeout test
Browse files Browse the repository at this point in the history
PR-URL: nodejs#55484
Refs: v8/v8@f915fa4
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
legendecas authored and tpoisseau committed Nov 21, 2024
1 parent e852a8d commit 42e06e1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/parallel/test-repl-preview-timeout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

const common = require('../common');
const ArrayStream = require('../common/arraystream');
const assert = require('assert');
const repl = require('repl');

common.skipIfInspectorDisabled();

const inputStream = new ArrayStream();
const outputStream = new ArrayStream();
repl.start({
input: inputStream,
output: outputStream,
useGlobal: false,
terminal: true,
useColors: true
});

let output = '';
outputStream.write = (chunk) => output += chunk;

// Input without '\n' triggering actual run.
const input = 'while (true) {}';
inputStream.emit('data', input);
// No preview available when timed out.
assert.strictEqual(output, input);

0 comments on commit 42e06e1

Please sign in to comment.