Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
feat: version to print v8 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Krems committed Oct 15, 2016
1 parent 0f8cd13 commit 0d31560
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/internal/inspect-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function aliasProperties(target, mapping) {
}

function createRepl(inspector) {
const { Debugger } = inspector;
const { Debugger, Runtime } = inspector;

let repl; // eslint-disable-line prefer-const
let lastCommand;
Expand Down Expand Up @@ -583,6 +583,16 @@ function createRepl(inspector) {
watchedExpressions.splice(index !== -1 ? index : +expr, 1);
},

get version() {
return Runtime.evaluate({
expression: 'process.versions.v8',
contextId: 1,
returnByValue: true,
}).then(({ result }) => {
print(result.value);
});
},

scripts: listScripts,
setBreakpoint,
clearBreakpoint,
Expand Down
4 changes: 4 additions & 0 deletions test/cli/launch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ test('examples/empty.js', (t) => {
.then(() => {
t.match(cli.output, 'hello world', 'repeats the last command on <enter>');
})
.then(() => cli.command('version'))
.then(() => {
t.match(cli.output, process.versions.v8, 'version prints the v8 version');
})
.then(() => cli.quit())
.then((code) => {
t.equal(code, 0, 'exits with success');
Expand Down

0 comments on commit 0d31560

Please sign in to comment.