mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 19:08:17 +00:00

Updating tests to use `common.fixturesDir` whenever possible/reasonable. Left out things like tests for `path` and `require.resolve`. PR-URL: https://github.com/nodejs/node/pull/6997 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
27 lines
596 B
JavaScript
27 lines
596 B
JavaScript
'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}');`]);
|