summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-syntax-error-stack.js
blob: af7e8bed6ea89c005d010787edc45d3389f8a14b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';

const common = require('../common');
const assert = require('assert');
const path = require('path');
const repl = require('repl');
let found = false;

process.on('exit', () => {
  assert.strictEqual(found, true);
});

common.ArrayStream.prototype.write = function(output) {
  if (/var foo bar;/.test(output))
    found = true;
};

const putIn = new common.ArrayStream();
repl.start('', putIn);
let file = path.join(common.fixturesDir, 'syntax', 'bad_syntax');

if (common.isWindows)
  file = file.replace(/\\/g, '\\\\');

putIn.run(['.clear']);
putIn.run([`require('${file}');`]);