REPL auto require built-in libs when their name is typed #2415

wants to merge 3 commits into


None yet

2 participants


Simple but useful. Typing 'fs' roughly translates into "global.fs = require('fs')" and checks that it's not overwriting some existing different value with the same name.

Node.js Foundation member

Brandon, the test is failing for me:

$ out/Release/node test/simple/test-repl-autolibs.js

        throw e; // process.nextTick error, or 'error' event on first tick
AssertionError: "{ Stats: [Function],\n  exists: [Function],\n  existsSync: [Function],\n  readFile: [Function],\n  readFileSync: [Function],\n  == "{ Stats: \u001b[36m[Function]\u001b[39m,\n  exists: \u001b[36m[Function]\u001b[39m,\n  existsSync: \u001b[36m[Function]\u001b[3
    at ArrayStream.write (/home/bnoordhuis/src/nodejs/master/test/simple/test-repl-autolibs.js:50:11)
    at Interface.<anonymous> (repl.js:184:27)
    at Interface.emit (events.js:67:17)
    at Interface._onLine (readline.js:160:10)
    at Interface._normalWrite (readline.js:228:10)
    at ArrayStream.<anonymous> (readline.js:75:12)
    at ArrayStream.emit (events.js:67:17)
    at /home/bnoordhuis/src/nodejs/master/test/simple/test-repl-autolibs.js:31:12
    at Array.forEach (native)
    at (/home/bnoordhuis/src/nodejs/master/test/simple/test-repl-autolibs.js:30:10)

Fixed. Looks like something changed to cause the tests to be run with colors disabled for the REPL tests at some point between 2 months ago and now.

Node.js Foundation member

Thanks Brandon, merged in b722771.

@bnoordhuis bnoordhuis closed this Feb 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment