node/test/parallel/test-repl-deprecated.js
Michaël Zasso 43e1ca84f2 test: add expectWarning to common
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>
2016-09-24 17:17:08 +02:00

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"');