var assert = require('assert');
var os = require('os');
var child_process = require('child_process');
+const stream = require('stream');
+const util = require('util');
exports.testDir = path.dirname(__filename);
return expectedExitCodes.indexOf(exitCode) > -1;
}
};
+
+// A stream to push an array into a REPL
+function ArrayStream() {
+ this.run = function(data) {
+ data.forEach(line => {
+ this.emit('data', line + '\n');
+ });
+ };
+}
+
+util.inherits(ArrayStream, stream.Stream);
+exports.ArrayStream = ArrayStream;
+ArrayStream.prototype.readable = true;
+ArrayStream.prototype.writable = true;
+ArrayStream.prototype.pause = function() {};
+ArrayStream.prototype.resume = function() {};
+ArrayStream.prototype.write = function() {};
var repl = require('repl');
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- var self = this;
- data.forEach(function(line) {
- self.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function() {};
-
var works = [['inner.one'], 'inner.o'];
-var putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn);
-/* eslint-disable required-modules */
'use strict';
+const common = require('../common');
var assert = require('assert');
var util = require('util');
var repl = require('repl');
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- var self = this;
- data.forEach(function(line) {
- self.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function() {};
+// This test adds global variables
+common.globalCheck = false;
-var putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn, null, true);
test1();
'use strict';
var common = require('../common'),
assert = require('assert'),
- Stream = require('stream'),
repl = require('repl');
-// create a dummy stream that does nothing
-var stream = new Stream();
-stream.write = stream.pause = stream.resume = function() {};
-stream.readable = stream.writable = true;
+// Create a dummy stream that does nothing
+const stream = new common.ArrayStream();
var r = repl.start({
input: stream,
var util = require('util');
var repl = require('repl');
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- var self = this;
- data.forEach(function(line) {
- self.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function() {};
-
-var putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn);
putIn.write = function(data) {
'use strict';
var common = require('../common'),
assert = require('assert'),
- Stream = require('stream'),
repl = require('repl'),
terminalExit = 0,
regularExit = 0;
-// create a dummy stream that does nothing
-var stream = new Stream();
-stream.write = stream.pause = stream.resume = function() {};
-stream.readable = stream.writable = true;
+// Create a dummy stream that does nothing
+const stream = new common.ArrayStream();
function testTerminalMode() {
var r1 = repl.start({
'use strict';
var common = require('../common'),
assert = require('assert'),
- Stream = require('stream'),
repl = require('repl');
common.globalCheck = false;
-// create a dummy stream that does nothing
-var stream = new Stream();
-stream.write = stream.pause = stream.resume = function() {};
-stream.readable = stream.writable = true;
+// Create a dummy stream that does nothing
+const stream = new common.ArrayStream();
// 1, mostly defaults
var r1 = repl.start({
var assert = require('assert');
var repl = require('repl');
-var Stream = require('stream');
-// create a dummy stream that does nothing
-var dummy = new Stream();
-dummy.write = dummy.pause = dummy.resume = function() {};
-dummy.readable = dummy.writable = true;
+// Create a dummy stream that does nothing
+const dummy = new common.ArrayStream();
function testReset(cb) {
var r = repl.start({
assert.strictEqual(found, true);
});
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- data.forEach(line => {
- this.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function(output) {
+common.ArrayStream.prototype.write = function(output) {
if (/var foo bar;/.test(output))
found = true;
};
-const putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
const testMe = repl.start('', putIn);
let file = path.resolve(__dirname, '../fixtures/syntax/bad_syntax');
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const util = require('util');
const repl = require('repl');
var referenceErrorCount = 0;
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- const self = this;
- data.forEach(function(line) {
- self.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function(msg) {
+common.ArrayStream.prototype.write = function(msg) {
if (msg.startsWith('ReferenceError: ')) {
referenceErrorCount++;
}
};
-const putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
const testMe = repl.start('', putIn);
// https://github.com/nodejs/node/issues/3346
assert.strictEqual(referenceErrors, expectedReferenceErrors);
});
-// A stream to push an array into a REPL
-function ArrayStream() {
- this.run = function(data) {
- var self = this;
- data.forEach(function(line) {
- self.emit('data', line + '\n');
- });
- };
-}
-util.inherits(ArrayStream, require('stream').Stream);
-ArrayStream.prototype.readable = true;
-ArrayStream.prototype.writable = true;
-ArrayStream.prototype.resume = function() {};
-ArrayStream.prototype.write = function() {};
-
var works = [['inner.one'], 'inner.o'];
-var putIn = new ArrayStream();
+const putIn = new common.ArrayStream();
var testMe = repl.start('', putIn);
// Some errors are passed to the domain, but do not callback