test: adapt debugger tests to V8 11.4
Accept a new `step` break message. PR-URL: https://github.com/nodejs/node/pull/49639 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
fd21429ef5
commit
6ccb15f7ef
@ -4,7 +4,7 @@ const spawn = require('child_process').spawn;
|
|||||||
|
|
||||||
const BREAK_MESSAGE = new RegExp('(?:' + [
|
const BREAK_MESSAGE = new RegExp('(?:' + [
|
||||||
'assert', 'break', 'break on start', 'debugCommand',
|
'assert', 'break', 'break on start', 'debugCommand',
|
||||||
'exception', 'other', 'promiseRejection',
|
'exception', 'other', 'promiseRejection', 'step',
|
||||||
].join('|') + ') in', 'i');
|
].join('|') + ') in', 'i');
|
||||||
|
|
||||||
let TIMEOUT = common.platformTimeout(5000);
|
let TIMEOUT = common.platformTimeout(5000);
|
||||||
@ -121,13 +121,13 @@ function startCLI(args, flags = [], spawnOpts = {}) {
|
|||||||
get breakInfo() {
|
get breakInfo() {
|
||||||
const output = this.output;
|
const output = this.output;
|
||||||
const breakMatch =
|
const breakMatch =
|
||||||
output.match(/break (?:on start )?in ([^\n]+):(\d+)\n/i);
|
output.match(/(step |break (?:on start )?)in ([^\n]+):(\d+)\n/i);
|
||||||
|
|
||||||
if (breakMatch === null) {
|
if (breakMatch === null) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not find breakpoint info in ${JSON.stringify(output)}`);
|
`Could not find breakpoint info in ${JSON.stringify(output)}`);
|
||||||
}
|
}
|
||||||
return { filename: breakMatch[1], line: +breakMatch[2] };
|
return { filename: breakMatch[2], line: +breakMatch[3] };
|
||||||
},
|
},
|
||||||
|
|
||||||
ctrlC() {
|
ctrlC() {
|
||||||
|
@ -27,7 +27,7 @@ const cli = startCLI(['--port=0', script]);
|
|||||||
|
|
||||||
await cli.stepCommand('n');
|
await cli.stepCommand('n');
|
||||||
assert.ok(
|
assert.ok(
|
||||||
cli.output.includes(`break in ${script}:2`),
|
cli.output.includes(`step in ${script}:2`),
|
||||||
'pauses in next line of the script');
|
'pauses in next line of the script');
|
||||||
assert.match(
|
assert.match(
|
||||||
cli.output,
|
cli.output,
|
||||||
@ -36,7 +36,7 @@ const cli = startCLI(['--port=0', script]);
|
|||||||
|
|
||||||
await cli.stepCommand('next');
|
await cli.stepCommand('next');
|
||||||
assert.ok(
|
assert.ok(
|
||||||
cli.output.includes(`break in ${script}:3`),
|
cli.output.includes(`step in ${script}:3`),
|
||||||
'pauses in next line of the script');
|
'pauses in next line of the script');
|
||||||
assert.match(
|
assert.match(
|
||||||
cli.output,
|
cli.output,
|
||||||
@ -89,7 +89,7 @@ const cli = startCLI(['--port=0', script]);
|
|||||||
await cli.stepCommand('');
|
await cli.stepCommand('');
|
||||||
assert.match(
|
assert.match(
|
||||||
cli.output,
|
cli.output,
|
||||||
/break in node:timers/,
|
/step in node:timers/,
|
||||||
'entered timers.js');
|
'entered timers.js');
|
||||||
|
|
||||||
await cli.stepCommand('cont');
|
await cli.stepCommand('cont');
|
||||||
|
@ -25,7 +25,7 @@ const path = require('path');
|
|||||||
.then(() => cli.stepCommand('n'))
|
.then(() => cli.stepCommand('n'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
cli.output.includes(`break in ${script}:2`),
|
cli.output.includes(`step in ${script}:2`),
|
||||||
'steps to the 2nd line'
|
'steps to the 2nd line'
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user