@@ -22,26 +22,26 @@ import * as cp from 'child_process';
2222import * as semver from 'semver' ;
2323const promisifyAll = require ( '@google-cloud/common' ) . util . promisifyAll ;
2424import { Debug } from '../src/debug' ;
25- var Debugger = require ( '../test/debugger.js' ) ;
25+ const Debugger = require ( '../test/debugger.js' ) ;
2626
27- var CLUSTER_WORKERS = 3 ;
27+ const CLUSTER_WORKERS = 3 ;
2828
2929// TODO: Determine if this path should contain 'build'
30- var FILENAME = 'build/test/fixtures/fib.js' ;
30+ const FILENAME = 'build/test/fixtures/fib.js' ;
3131
32- var delay = function ( delayTimeMS ) {
32+ const delay = function ( delayTimeMS ) {
3333 return new Promise ( function ( resolve , reject ) {
3434 setTimeout ( resolve , delayTimeMS ) ;
3535 } ) ;
3636} ;
3737
3838// This test could take up to 70 seconds.
3939describe ( '@google-cloud/debug end-to-end behavior' , function ( ) {
40- var api ;
40+ let api ;
4141
42- var debuggeeId ;
43- var projectId ;
44- var children = [ ] ;
42+ let debuggeeId ;
43+ let projectId ;
44+ let children = [ ] ;
4545
4646 before ( function ( ) {
4747 promisifyAll ( Debugger ) ;
@@ -51,10 +51,10 @@ describe('@google-cloud/debug end-to-end behavior', function () {
5151 beforeEach ( function ( ) {
5252 this . timeout ( 10 * 1000 ) ;
5353 return new Promise ( function ( resolve , reject ) {
54- var numChildrenReady = 0 ;
54+ let numChildrenReady = 0 ;
5555
5656 // Process a status message sent from a child process.
57- var handler = function ( c ) {
57+ const handler = function ( c ) {
5858 console . log ( c ) ;
5959 if ( c . error ) {
6060 reject ( new Error ( 'A child reported the following error: ' + c . error ) ) ;
@@ -81,16 +81,16 @@ describe('@google-cloud/debug end-to-end behavior', function () {
8181 // Handle stdout/stderr output from a child process. More specifically,
8282 // write the child process's output to a transcript.
8383 // Each child has its own transcript.
84- var stdoutHandler = function ( index ) {
84+ const stdoutHandler = function ( index ) {
8585 return function ( chunk ) {
8686 children [ index ] . transcript += chunk ;
8787 } ;
8888 } ;
8989
90- for ( var i = 0 ; i < CLUSTER_WORKERS ; i ++ ) {
90+ for ( let i = 0 ; i < CLUSTER_WORKERS ; i ++ ) {
9191 // TODO: Determine how to have this not of type `any`.
9292 // Fork child processes that sned messages to this process with IPC.
93- var child : any = { transcript : '' } ;
93+ const child : any = { transcript : '' } ;
9494 // TODO: Fix this cast to any.
9595 child . process = cp . fork ( FILENAME , {
9696 execArgv : [ ] ,
@@ -110,11 +110,11 @@ describe('@google-cloud/debug end-to-end behavior', function () {
110110 afterEach ( function ( ) {
111111 this . timeout ( 5 * 1000 ) ;
112112 // Create a promise for each child that resolves when that child exits.
113- var childExitPromises = children . map ( function ( child ) {
113+ const childExitPromises = children . map ( function ( child ) {
114114 console . log ( child . transcript ) ;
115115 child . process . kill ( ) ;
116116 return new Promise ( function ( resolve , reject ) {
117- var timeout = setTimeout ( function ( ) {
117+ const timeout = setTimeout ( function ( ) {
118118 reject ( new Error ( 'A child process failed to exit.' ) ) ;
119119 } , 3000 ) ;
120120 child . process . on ( 'exit' , function ( ) {
@@ -138,25 +138,25 @@ describe('@google-cloud/debug end-to-end behavior', function () {
138138 // Check that the debuggee created in this test is among the list of
139139 // debuggees, then list its breakpoints
140140
141- var debuggees = results [ 0 ] ;
141+ const debuggees = results [ 0 ] ;
142142
143143 console . log ( '-- List of debuggees\n' ,
144144 util . inspect ( debuggees , { depth : null } ) ) ;
145145 assert . ok ( debuggees , 'should get a valid ListDebuggees response' ) ;
146146 // TODO: Fix this cast to any.
147- var result = _ . find ( debuggees , function ( d : any ) {
147+ const result = _ . find ( debuggees , function ( d : any ) {
148148 return d . id === debuggeeId ;
149149 } ) ;
150150 assert . ok ( result , 'should find the debuggee we just registered' ) ;
151151 return api . listBreakpoints ( debuggeeId ) ;
152152 } ) . then ( function ( results ) {
153153 // Delete every breakpoint
154154
155- var breakpoints = results [ 0 ] ;
155+ const breakpoints = results [ 0 ] ;
156156
157157 console . log ( '-- List of breakpoints\n' , breakpoints ) ;
158158
159- var promises = breakpoints . map ( function ( breakpoint ) {
159+ const promises = breakpoints . map ( function ( breakpoint ) {
160160 return api . deleteBreakpoint ( debuggeeId , breakpoint . id ) ;
161161 } ) ;
162162
@@ -182,7 +182,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
182182 // Check that the breakpoint was set, and then wait for the log to be
183183 // written to
184184
185- var breakpoint = results [ 0 ] ;
185+ const breakpoint = results [ 0 ] ;
186186
187187 assert . ok ( breakpoint , 'should have set a breakpoint' ) ;
188188 assert . ok ( breakpoint . id , 'breakpoint should have an id' ) ;
@@ -194,7 +194,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
194194 } ) . then ( function ( results ) {
195195 // Check the contents of the log, but keep the original breakpoint.
196196
197- var breakpoint = results [ 0 ] ;
197+ const breakpoint = results [ 0 ] ;
198198
199199 children . forEach ( function ( child , index ) {
200200 assert ( child . transcript . indexOf ( 'o is: {"a":[1,"hi",true]}' ) !== - 1 ,
@@ -216,7 +216,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
216216 // Check that the breakpoint was set, and then wait for the breakpoint to
217217 // be hit
218218
219- var breakpoint = results [ 0 ] ;
219+ const breakpoint = results [ 0 ] ;
220220
221221 console . log ( '-- resolution of setBreakpoint' , breakpoint ) ;
222222 assert . ok ( breakpoint , 'should have set a breakpoint' ) ;
@@ -229,22 +229,22 @@ describe('@google-cloud/debug end-to-end behavior', function () {
229229 } ) . then ( function ( results ) {
230230 // Get the breakpoint
231231
232- var breakpoint = results [ 0 ] ;
232+ const breakpoint = results [ 0 ] ;
233233
234234 console . log ( '-- now checking if the breakpoint was hit' ) ;
235235 return api . getBreakpoint ( debuggeeId , breakpoint . id ) ;
236236 } ) . then ( function ( results ) {
237237 // Check that the breakpoint was hit and contains the correct information,
238238 // which ends the test
239239
240- var breakpoint = results [ 0 ] ;
240+ const breakpoint = results [ 0 ] ;
241241
242- var arg ;
242+ let arg ;
243243 console . log ( '-- results of get breakpoint\n' , breakpoint ) ;
244244 assert . ok ( breakpoint , 'should have a breakpoint in the response' ) ;
245245 assert . ok ( breakpoint . isFinalState , 'breakpoint should have been hit' ) ;
246246 assert . ok ( Array . isArray ( breakpoint . stackFrames ) , 'should have stack ' ) ;
247- var top = breakpoint . stackFrames [ 0 ] ;
247+ const top = breakpoint . stackFrames [ 0 ] ;
248248 assert . ok ( top , 'should have a top entry' ) ;
249249 assert . ok ( top . function , 'frame should have a function property' ) ;
250250 assert . strictEqual ( top . function , 'fib' ) ;
@@ -288,13 +288,13 @@ describe('@google-cloud/debug end-to-end behavior', function () {
288288 // Check that the debuggee created in this test is among the list of
289289 // debuggees, then list its breakpoints
290290
291- var debuggees = results [ 0 ] ;
291+ const debuggees = results [ 0 ] ;
292292
293293 console . log ( '-- List of debuggees\n' ,
294294 util . inspect ( debuggees , { depth : null } ) ) ;
295295 assert . ok ( debuggees , 'should get a valid ListDebuggees response' ) ;
296296 // TODO: Fix this cast to any.
297- var result = _ . find ( debuggees , function ( d : any ) {
297+ const result = _ . find ( debuggees , function ( d : any ) {
298298 return d . id === debuggeeId ;
299299 } ) ;
300300 assert . ok ( result , 'should find the debuggee we just registered' ) ;
@@ -303,11 +303,11 @@ describe('@google-cloud/debug end-to-end behavior', function () {
303303 } ) . then ( function ( results ) {
304304 // Delete every breakpoint
305305
306- var breakpoints = results [ 0 ] ;
306+ const breakpoints = results [ 0 ] ;
307307
308308 console . log ( '-- List of breakpoints\n' , breakpoints ) ;
309309
310- var promises = breakpoints . map ( function ( breakpoint ) {
310+ const promises = breakpoints . map ( function ( breakpoint ) {
311311 return api . deleteBreakpoint ( debuggeeId , breakpoint . id ) ;
312312 } ) ;
313313
@@ -332,7 +332,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
332332 } ) . then ( function ( results ) {
333333 // Check that the breakpoint was set, and then wait for the log to be
334334 // written to
335- var breakpoint = results [ 0 ] ;
335+ const breakpoint = results [ 0 ] ;
336336
337337 assert . ok ( breakpoint , 'should have set a breakpoint' ) ;
338338 assert . ok ( breakpoint . id , 'breakpoint should have an id' ) ;
@@ -344,7 +344,7 @@ describe('@google-cloud/debug end-to-end behavior', function () {
344344 } ) . then ( function ( results ) {
345345 // Check that the contents of the log is correct
346346
347- var breakpoint = results [ 0 ] ;
347+ const breakpoint = results [ 0 ] ;
348348
349349 // If no throttling occurs, we expect ~20 logs since we are logging
350350 // 2x per second over a 10 second period.
0 commit comments