@ -16,7 +16,7 @@ setTimeout(function() {
let resCount = 0 ;
let resCount = 0 ;
const p = new debug . Protocol ( ) ;
const p = new debug . Protocol ( ) ;
p . onResponse = function ( res ) {
p . onResponse = function ( ) {
resCount ++ ;
resCount ++ ;
} ;
} ;
@ -89,7 +89,7 @@ function addTest(cb) {
addTest ( function ( client , done ) {
addTest ( function ( client , done ) {
console . error ( 'requesting version' ) ;
console . error ( 'requesting version' ) ;
client . reqVersion ( function ( err , v ) {
client . reqVersion ( function ( err , v ) {
assert . ok ( ! err ) ;
assert . ifError ( err ) ;
console . log ( 'version: %s' , v ) ;
console . log ( 'version: %s' , v ) ;
assert . strictEqual ( process . versions . v8 , v ) ;
assert . strictEqual ( process . versions . v8 , v ) ;
done ( ) ;
done ( ) ;
@ -99,13 +99,13 @@ addTest(function(client, done) {
addTest ( function ( client , done ) {
addTest ( function ( client , done ) {
console . error ( 'requesting scripts' ) ;
console . error ( 'requesting scripts' ) ;
client . reqScripts ( function ( err ) {
client . reqScripts ( function ( err ) {
assert . ok ( ! err ) ;
assert . ifError ( err ) ;
console . error ( 'got %d scripts' , Object . keys ( client . scripts ) . length ) ;
console . error ( 'got %d scripts' , Object . keys ( client . scripts ) . length ) ;
let foundMainScript = false ;
let foundMainScript = false ;
for ( const k in client . scripts ) {
for ( const k in client . scripts ) {
const script = client . scripts [ k ] ;
const script = client . scripts [ k ] ;
if ( script && script . name === 'node.js' ) {
if ( script && script . name === 'bootstrap_ node.js' ) {
foundMainScript = true ;
foundMainScript = true ;
break ;
break ;
}
}
@ -119,7 +119,7 @@ addTest(function(client, done) {
console . error ( 'eval 2+2' ) ;
console . error ( 'eval 2+2' ) ;
client . reqEval ( '2+2' , function ( err , res ) {
client . reqEval ( '2+2' , function ( err , res ) {
console . error ( res ) ;
console . error ( res ) ;
assert . ok ( ! err ) ;
assert . ifError ( err ) ;
assert . strictEqual ( res . text , '4' ) ;
assert . strictEqual ( res . text , '4' ) ;
assert . strictEqual ( res . value , 4 ) ;
assert . strictEqual ( res . value , 4 ) ;
done ( ) ;
done ( ) ;
@ -137,7 +137,7 @@ function doTest(cb, done) {
const args = [ '--debug=' + debugPort , '-e' , script ] ;
const args = [ '--debug=' + debugPort , '-e' , script ] ;
nodeProcess = spawn ( process . execPath , args ) ;
nodeProcess = spawn ( process . execPath , args ) ;
nodeProcess . stdout . once ( 'data' , function ( c ) {
nodeProcess . stdout . once ( 'data' , function ( ) {
console . log ( '>>> new node process: %d' , nodeProcess . pid ) ;
console . log ( '>>> new node process: %d' , nodeProcess . pid ) ;
let failed = true ;
let failed = true ;
try {
try {
@ -158,7 +158,7 @@ function doTest(cb, done) {
console . error ( 'got stderr data %j' , data ) ;
console . error ( 'got stderr data %j' , data ) ;
nodeProcess . stderr . resume ( ) ;
nodeProcess . stderr . resume ( ) ;
b += data ;
b += data ;
if ( didTryConnect === false && b . match ( /Debugger listening on port / ) ) {
if ( didTryConnect === false && b . match ( /Debugger listening on / ) ) {
didTryConnect = true ;
didTryConnect = true ;
// The timeout is here to expose a race in the bootstrap process.
// The timeout is here to expose a race in the bootstrap process.
@ -168,10 +168,10 @@ function doTest(cb, done) {
function tryConnect ( ) {
function tryConnect ( ) {
// Wait for some data before trying to connect
// Wait for some data before trying to connect
var c = new debug . Client ( ) ;
const c = new debug . Client ( ) ;
console . error ( '>>> connecting...' ) ;
console . error ( '>>> connecting...' ) ;
c . connect ( debug . port ) ;
c . connect ( debug . port ) ;
c . on ( 'break' , function ( brk ) {
c . on ( 'break' , function ( ) {
c . reqContinue ( function ( ) { } ) ;
c . reqContinue ( function ( ) { } ) ;
} ) ;
} ) ;
c . on ( 'ready' , function ( ) {
c . on ( 'ready' , function ( ) {
@ -199,7 +199,7 @@ function doTest(cb, done) {
function run ( ) {
function run ( ) {
var t = tests [ 0 ] ;
const t = tests [ 0 ] ;
if ( ! t ) return ;
if ( ! t ) return ;
doTest ( t , function ( ) {
doTest ( t , function ( ) {