11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst ArrayStream = require('../common/arraystream'); 51cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ciconst repl = require('repl'); 81cb0ef41Sopenharmony_cilet found = false; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciprocess.on('exit', () => { 111cb0ef41Sopenharmony_ci assert.strictEqual(found, true); 121cb0ef41Sopenharmony_ci}); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciArrayStream.prototype.write = function(output) { 151cb0ef41Sopenharmony_ci // Matching only on a minimal piece of the stack because the string will vary 161cb0ef41Sopenharmony_ci // greatly depending on the JavaScript engine. V8 includes `;` because it 171cb0ef41Sopenharmony_ci // displays the line of code (`var foo bar;`) that is causing a problem. 181cb0ef41Sopenharmony_ci // ChakraCore does not display the line of code but includes `;` in the phrase 191cb0ef41Sopenharmony_ci // `Expected ';' `. 201cb0ef41Sopenharmony_ci if (/;/.test(output)) 211cb0ef41Sopenharmony_ci found = true; 221cb0ef41Sopenharmony_ci}; 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ciconst putIn = new ArrayStream(); 251cb0ef41Sopenharmony_cirepl.start('', putIn); 261cb0ef41Sopenharmony_cilet file = fixtures.path('syntax', 'bad_syntax'); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ciif (common.isWindows) 291cb0ef41Sopenharmony_ci file = file.replace(/\\/g, '\\\\'); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ciputIn.run(['.clear']); 321cb0ef41Sopenharmony_ciputIn.run([`require('${file}');`]); 33