File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const repl = require ( 'repl' ) ;
5+
6+ const expected = [
7+ 'replServer.convertToContext() is deprecated'
8+ ] ;
9+
10+ process . on ( 'warning' , common . mustCall ( ( warning ) => {
11+ assert . strictEqual ( warning . name , 'DeprecationWarning' ) ;
12+ assert . notStrictEqual ( expected . indexOf ( warning . message ) , - 1 ,
13+ `unexpected error message: "${ warning . message } "` ) ;
14+ // Remove a warning message after it is seen so that we guarantee that we get
15+ // each message only once.
16+ expected . splice ( expected . indexOf ( warning . message ) , 1 ) ;
17+ } , expected . length ) ) ;
18+
19+ // Create a dummy stream that does nothing
20+ const stream = new common . ArrayStream ( ) ;
21+
22+ const replServer = repl . start ( {
23+ input : stream ,
24+ output : stream
25+ } ) ;
26+
27+ const cmd = replServer . convertToContext ( 'var name = "nodejs"' ) ;
28+ assert . strictEqual ( cmd , 'self.context.name = "nodejs"' ) ;
You can’t perform that action at this time.
0 commit comments