Skip to content

Commit

Permalink
test: add repl preview timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Oct 21, 2024
1 parent 553c94c commit d160567
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 d160567

Please sign in to comment.