(cb)
| 28 | common.allowGlobals(42); |
| 29 | |
| 30 | function testReset(cb) { |
| 31 | const { replServer } = startNewREPLServer(); |
| 32 | replServer.context.foo = 42; |
| 33 | replServer.on('reset', common.mustCall(function(context) { |
| 34 | assert(!!context, 'REPL did not emit a context with reset event'); |
| 35 | assert.strictEqual(context, replServer.context, 'REPL emitted incorrect context. ' + |
| 36 | `context is ${util.inspect(context)}, expected ${util.inspect(replServer.context)}`); |
| 37 | assert.strictEqual( |
| 38 | context.foo, |
| 39 | undefined, |
| 40 | 'REPL emitted the previous context and is not using global as context. ' + |
| 41 | `context.foo is ${context.foo}, expected undefined.` |
| 42 | ); |
| 43 | context.foo = 42; |
| 44 | cb(); |
| 45 | })); |
| 46 | replServer.resetContext(); |
| 47 | } |
| 48 | |
| 49 | function testResetGlobal() { |
| 50 | const { replServer } = startNewREPLServer({ useGlobal: true }); |
no test coverage detected