Skip to content

Commit dbfec29

Browse files
thefourtheyeMylesBorins
authored andcommitted
test: fix and improve debug-break-on-uncaught
This test runs based on a expectation that the stderr will get the string 'Debugger listening on port'. But the actual message printed to stderr has changed to 'Debugger listening on host:port'. So the the actuals tests did not even start and eventually timeout. Apart from that, changed `var`s to `let`s or `const`s. Refs: #10361 PR-URL: #10370 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]
1 parent 80f4a37 commit dbfec29

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

‎test/debugger/test-debug-break-on-uncaught.js‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const spawn = require('child_process').spawn;
55
constcommon=require('../common');
66
constdebug=require('_debugger');
77

8-
varscenarios=[];
8+
constscenarios=[];
99

1010
addScenario('global.js',2);
1111
addScenario('timeout.js',2);
@@ -21,34 +21,33 @@ function addScenario(scriptName, throwsOnLine){
2121
}
2222

2323
functionrun(){
24-
varnext=scenarios.shift();
24+
constnext=scenarios.shift();
2525
if(next)next();
2626
}
2727

2828
functionrunScenario(scriptName,throwsOnLine,next){
29-
console.log('**[ %s ]**',scriptName);
30-
varasserted=false;
31-
varport=common.PORT;
29+
letasserted=false;
30+
constport=common.PORT;
3231

33-
vartestScript=path.join(
32+
consttestScript=path.join(
3433
common.fixturesDir,
3534
'uncaught-exceptions',
3635
scriptName
3736
);
3837

39-
varchild=spawn(process.execPath,['--debug-brk='+port,testScript]);
38+
constchild=spawn(process.execPath,['--debug-brk='+port,testScript]);
4039
child.on('close',function(){
4140
assert(asserted,'debugger did not pause on exception');
4241
if(next)next();
4342
});
4443

45-
varexceptions=[];
44+
constexceptions=[];
4645

47-
varstderr='';
46+
letstderr='';
4847

4948
functionstderrListener(data){
5049
stderr+=data;
51-
if(stderr.includes('Debugger listening on port')){
50+
if(stderr.includes('Debugger listening on ')){
5251
setTimeout(setupClient.bind(null,runTest),200);
5352
child.stderr.removeListener('data',stderrListener);
5453
}
@@ -58,7 +57,7 @@ function runScenario(scriptName, throwsOnLine, next){
5857
child.stderr.on('data',stderrListener);
5958

6059
functionsetupClient(callback){
61-
varclient=newdebug.Client();
60+
constclient=newdebug.Client();
6261

6362
client.once('ready',callback.bind(null,client));
6463

@@ -83,14 +82,14 @@ function runScenario(scriptName, throwsOnLine, next){
8382
enabled: true
8483
}
8584
},
86-
function(error,result){
85+
function(error){
8786
assert.ifError(error);
8887

8988
client.on('exception',function(event){
9089
exceptions.push(event.body);
9190
});
9291

93-
client.reqContinue(function(error,result){
92+
client.reqContinue(function(error){
9493
assert.ifError(error);
9594
setTimeout(assertHasPaused.bind(null,client),100);
9695
});

0 commit comments

Comments
(0)