1'use strict'; 2 3const common = require('../common'); 4const ArrayStream = require('../common/arraystream'); 5const fixtures = require('../common/fixtures'); 6const assert = require('assert'); 7const repl = require('repl'); 8let found = false; 9 10process.on('exit', () => { 11 assert.strictEqual(found, true); 12}); 13 14ArrayStream.prototype.write = function(output) { 15 // Matching only on a minimal piece of the stack because the string will vary 16 // greatly depending on the JavaScript engine. V8 includes `;` because it 17 // displays the line of code (`var foo bar;`) that is causing a problem. 18 // ChakraCore does not display the line of code but includes `;` in the phrase 19 // `Expected ';' `. 20 if (/;/.test(output)) 21 found = true; 22}; 23 24const putIn = new ArrayStream(); 25repl.start('', putIn); 26let file = fixtures.path('syntax', 'bad_syntax'); 27 28if (common.isWindows) 29 file = file.replace(/\\/g, '\\\\'); 30 31putIn.run(['.clear']); 32putIn.run([`require('${file}');`]); 33