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

Commit 0d31560

Browse files
author
Jan Krems
committed
feat: version to print v8 version
1 parent 0f8cd13 commit 0d31560

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/internal/inspect-repl.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function aliasProperties(target, mapping) {
192192
}
193193

194194
function createRepl(inspector) {
195-
const { Debugger } = inspector;
195+
const { Debugger, Runtime } = inspector;
196196

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

586+
get version() {
587+
return Runtime.evaluate({
588+
expression: 'process.versions.v8',
589+
contextId: 1,
590+
returnByValue: true,
591+
}).then(({ result }) => {
592+
print(result.value);
593+
});
594+
},
595+
586596
scripts: listScripts,
587597
setBreakpoint,
588598
clearBreakpoint,

test/cli/launch.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ test('examples/empty.js', (t) => {
1818
.then(() => {
1919
t.match(cli.output, 'hello world', 'repeats the last command on <enter>');
2020
})
21+
.then(() => cli.command('version'))
22+
.then(() => {
23+
t.match(cli.output, process.versions.v8, 'version prints the v8 version');
24+
})
2125
.then(() => cli.quit())
2226
.then((code) => {
2327
t.equal(code, 0, 'exits with success');

0 commit comments

Comments
 (0)