Roman Reiss | f29762f | 2015-05-19 11:00:06 | [diff] [blame] | 1 | 'use strict'; |
Nathan Rajlich | 0285dae | 2012-08-24 20:18:19 | [diff] [blame] | 2 | var common = require('../common'), |
| 3 | assert = require('assert'), |
| 4 | Stream = require('stream'), |
| 5 | repl = require('repl'); |
| 6 | |
| 7 | // create a dummy stream that does nothing |
| 8 | var stream = new Stream(); |
Roman Reiss | f29762f | 2015-05-19 11:00:06 | [diff] [blame] | 9 | stream.write = stream.pause = stream.resume = function() {}; |
Nathan Rajlich | 0285dae | 2012-08-24 20:18:19 | [diff] [blame] | 10 | stream.readable = stream.writable = true; |
| 11 | |
| 12 | var r = repl.start({ |
| 13 | input: stream, |
| 14 | output: stream, |
| 15 | useGlobal: false |
| 16 | }); |
| 17 | |
| 18 | |
| 19 | // ensure that the repl context gets its own "console" instance |
| 20 | assert(r.context.console); |
| 21 | |
| 22 | // ensure that the repl console instance is not the global one |
| 23 | assert.notStrictEqual(r.context.console, console); |