mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

There are multiple tests that use the same boilerplate to test that warnings are correctly emitted. This adds a new common function to do that and changes the tests to use it. PR-URL: https://github.com/nodejs/node/pull/8662 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
506 B
JavaScript
19 lines
506 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const repl = require('repl');
|
|
|
|
common.expectWarning('DeprecationWarning',
|
|
'replServer.convertToContext() is deprecated');
|
|
|
|
// 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"');
|