mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
330f25ef82
Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
36 lines
910 B
JavaScript
36 lines
910 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const ArrayStream = require('../common/arraystream');
|
|
const assert = require('assert');
|
|
const repl = require('repl');
|
|
|
|
common.skipIfInspectorDisabled();
|
|
|
|
// This test verifies that the V8 inspector API is usable in the REPL.
|
|
|
|
const putIn = new ArrayStream();
|
|
let output = '';
|
|
putIn.write = function(data) {
|
|
output += data;
|
|
};
|
|
|
|
const testMe = repl.start('', putIn);
|
|
|
|
putIn.run(['const myVariable = 42']);
|
|
|
|
testMe.complete('myVar', common.mustCall((error, data) => {
|
|
assert.deepStrictEqual(data, [['myVariable'], 'myVar']);
|
|
}));
|
|
|
|
putIn.run([
|
|
'const inspector = require("inspector")',
|
|
'const session = new inspector.Session()',
|
|
'session.connect()',
|
|
'session.post("Runtime.evaluate", { expression: "1 + 1" }, console.log)',
|
|
'session.disconnect()',
|
|
]);
|
|
|
|
assert(output.includes(
|
|
"null { result: { type: 'number', value: 2, description: '2' } }"));
|