Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test
  • Loading branch information
princejwesley committed Jul 30, 2016
commit 05ba90243c513039fa4b78eb7b1a5dbf98c5969d
28 changes: 28 additions & 0 deletions test/parallel/test-repl-deprecated.js
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"');