-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repl: deprecate unused function convertToContext
PR-URL: #7829 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
588ee22
commit 488d28d
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const repl = require('repl'); | ||
|
||
const expected = [ | ||
'replServer.convertToContext() is deprecated' | ||
]; | ||
|
||
process.on('warning', common.mustCall((warning) => { | ||
assert.strictEqual(warning.name, 'DeprecationWarning'); | ||
assert.notStrictEqual(expected.indexOf(warning.message), -1, | ||
`unexpected error message: "${warning.message}"`); | ||
// Remove a warning message after it is seen so that we guarantee that we get | ||
// each message only once. | ||
expected.splice(expected.indexOf(warning.message), 1); | ||
}, expected.length)); | ||
|
||
// Create a dummy stream that does nothing | ||
const stream = new common.ArrayStream(); | ||
|
||
const replServer = repl.start({ | ||
input: stream, | ||
output: stream | ||
}); | ||
|
||
const cmd = replServer.convertToContext('var name = "nodejs"'); | ||
assert.strictEqual(cmd, 'self.context.name = "nodejs"'); |