@@ -108,22 +108,19 @@ const formatBreakpoints = function(
108108} ;
109109
110110export class Debuglet extends EventEmitter {
111- // TODO: Determine how to update the tests so that this can be private.
112- config_ : DebugAgentConfig ;
113111 private debug_ : Debug ;
114112 private v8debug_ : V8DebugApi | null ;
115113 private running_ : boolean ;
116114 private project_ : string | null ;
117- // TODO: Determine how to update the tests so that this can be private.
115+ private debugletApi_ : Controller ;
116+ private completedBreakpointMap_ : { [ key : string ] : boolean } ;
117+
118+ // Exposed for testing
119+ config_ : DebugAgentConfig ;
118120 fetcherActive_ : boolean ;
119- // TODO: Determine how to update the tests so that this can be private.
120121 logger_ : Logger ;
121- private debugletApi_ : Controller ;
122- // TODO: Determine how to update the tests so that this can be private.
123122 debuggee_ : Debuggee | null ;
124- // TODO: Determine how to update the tests so that this can be private.
125123 activeBreakpointMap_ : { [ key : string ] : Breakpoint } ;
126- private completedBreakpointMap_ : { [ key : string ] : boolean } ;
127124
128125 /**
129126 * @param {Debug } debug - A Debug instance.
@@ -241,17 +238,18 @@ export class Debuglet extends EventEmitter {
241238
242239 const jsStats = fileStats . selectStats ( / .j s $ / ) ;
243240 const mapFiles = fileStats . selectFiles ( / .m a p $ / , process . cwd ( ) ) ;
244- SourceMapper . create ( mapFiles , async function ( err3 , mapper ) {
241+ SourceMapper . create ( mapFiles , async function ( err3 , sourcemapper ) {
245242 if ( err3 ) {
246243 that . logger_ . error ( 'Error processing the sourcemaps.' , err3 ) ;
247244 that . emit ( 'initError' , err3 ) ;
248245 return ;
249246 }
250247
251- that . v8debug_ = v8debugapi . create (
252- // TODO: Handle the case where `mapper` is `undefined`.
253- that . logger_ , that . config_ , jsStats ,
254- mapper as SourceMapper . SourceMapper ) ;
248+ // At this point err3 being falsy implies sourcemapper is defined
249+ const mapper = sourcemapper as SourceMapper . SourceMapper ;
250+
251+ that . v8debug_ =
252+ v8debugapi . create ( that . logger_ , that . config_ , jsStats , mapper ) ;
255253
256254 id = id || fileStats . hash ;
257255
@@ -278,7 +276,7 @@ export class Debuglet extends EventEmitter {
278276 that . config_ . serviceContext = {
279277 service : clusterName ,
280278 version : 'unversioned' ,
281- minorVersion_ : null
279+ minorVersion_ : undefined
282280 } ;
283281 } catch ( err ) {
284282 /* we are not running on GKE - Ignore error. */
@@ -308,7 +306,7 @@ export class Debuglet extends EventEmitter {
308306 that . debuggee_ = Debuglet . createDebuggee (
309307 // TODO: Address the case when `id` is `undefined`.
310308 project , id as string , that . config_ . serviceContext , sourceContext ,
311- that . config_ . description , null , onGCP ) ;
309+ onGCP , that . config_ . description , undefined ) ;
312310 that . scheduleRegistration_ ( 0 /* immediately */ ) ;
313311 that . emit ( 'started' ) ;
314312 } ) ;
@@ -321,13 +319,11 @@ export class Debuglet extends EventEmitter {
321319 */
322320 // TODO: Determine the type of sourceContext
323321 static createDebuggee (
324- projectId : string , uid : string , serviceContext : {
325- service : string | null ,
326- version : string | null ,
327- minorVersion_ : string | null
328- } ,
329- sourceContext : { [ key : string ] : string } , description : string | null ,
330- errorMessage : string | null , onGCP : boolean ) : Debuggee {
322+ projectId : string , uid : string ,
323+ serviceContext :
324+ { service ?: string , version ?: string , minorVersion_ ?: string } ,
325+ sourceContext : { [ key : string ] : string } , onGCP : boolean ,
326+ description ?: string , errorMessage ?: string ) : Debuggee {
331327 const cwd = process . cwd ( ) ;
332328 const mainScript = path . relative ( cwd , process . argv [ 1 ] ) ;
333329
@@ -378,7 +374,7 @@ export class Debuglet extends EventEmitter {
378374
379375 const statusMessage = errorMessage ?
380376 new StatusMessage ( StatusMessage . UNSPECIFIED , errorMessage , true ) :
381- null ;
377+ undefined ;
382378
383379 const properties = {
384380 project : projectId ,
0 commit comments