path = require('path'),
net = require('net'),
vm = require('vm'),
- repl = require('repl'),
+ module = require('module'),
+ repl = module.requireRepl(),
inherits = util.inherits,
assert = require('assert'),
spawn = require('child_process').spawn;
if (parseInt(process.env['NODE_DISABLE_COLORS'], 10)) {
opts.useColors = false;
}
+
this.repl = repl.start(opts);
// Do not print useless warning
if (lineno == 1) {
// The first line needs to have the module wrapper filtered out of
// it.
- var wrapper = require('module').wrapper[0];
+ var wrapper = module.wrapper[0];
lines[i] = lines[i].slice(wrapper.length);
client.currentSourceColumn -= wrapper.length;
testMe.complete('toSt', function(error, data) {
assert.deepEqual(data, [['toString'], 'toSt']);
});
+
+// Tab complete provides built in libs for require()
+putIn.run(['.clear']);
+
+testMe.complete('require(\'', function(error, data) {
+ assert.strictEqual(error, null);
+ repl._builtinLibs.forEach(function(lib) {
+ assert.notStrictEqual(data[0].indexOf(lib), -1, lib + ' not found');
+ });
+});
+
+testMe.complete('require(\'n', function(error, data) {
+ assert.strictEqual(error, null);
+ assert.deepEqual(data, [['net'], 'n']);
+});