@@ -22,7 +22,7 @@ import {DebugAgentConfig} from '../src/agent/config';
2222const breakpointInFoo : apiTypes . Breakpoint = {
2323 id : 'fake-id-123' ,
2424 // TODO: Determine if we should be restricting to only the build directory.
25- location : { path : 'build/test/test-v8debugapi-code.js' , line : 4 }
25+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 }
2626} as apiTypes . Breakpoint ;
2727
2828const MAX_INT = 2147483647 ; // Max signed int32.
@@ -394,22 +394,22 @@ describe('v8debugapi', function() {
394394 describe ( 'path normalization' , function ( ) {
395395 // TODO: Have this actually be a list of Breakpoints
396396 const breakpoints = [
397- { id : 'path0' , location : { line : 4 , path : path . join ( path . sep , 'test' ,
397+ { id : 'path0' , location : { line : 5 , path : path . join ( path . sep , 'test' ,
398398 'test-v8debugapi-code.js' ) } } as any as apiTypes . Breakpoint ,
399- { id : 'path1' , location : { line : 4 , path : path . join ( 'test' ,
399+ { id : 'path1' , location : { line : 5 , path : path . join ( 'test' ,
400400 'test-v8debugapi-code.js' ) } } as any as apiTypes . Breakpoint ,
401- { id : 'path2' , location : { line : 4 , path :
401+ { id : 'path2' , location : { line : 5 , path :
402402 // Usage the absolute path to `test-v8debugapi-code.js`.
403403 __filename . split ( path . sep ) . slice ( 0 , - 1 ) . concat ( 'test-v8debugapi-code.js' ) . join ( path . sep )
404404 } } as any as apiTypes . Breakpoint ,
405405 { id : 'with . in path' , location : { path : path . join ( 'test' , '.' ,
406- 'test-v8debugapi-code.js' ) , line : 4 } } as any as apiTypes . Breakpoint ,
406+ 'test-v8debugapi-code.js' ) , line : 5 } } as any as apiTypes . Breakpoint ,
407407 { id : 'with . in path' , location : { path : path . join ( '.' ,
408- 'test-v8debugapi-code.js' ) , line : 4 } } as any as apiTypes . Breakpoint ,
408+ 'test-v8debugapi-code.js' ) , line : 5 } } as any as apiTypes . Breakpoint ,
409409 { id : 'with .. in path' , location : { path : path . join ( 'test' , '..' ,
410- 'test-v8debugapi-code.js' ) , line : 4 } } as any as apiTypes . Breakpoint ,
410+ 'test-v8debugapi-code.js' ) , line : 5 } } as any as apiTypes . Breakpoint ,
411411 { id : 'with .. in path' , location : { path : path . join ( '..' , 'test' ,
412- 'test-v8debugapi-code.js' ) , line : 4 } } as any as apiTypes . Breakpoint
412+ 'test-v8debugapi-code.js' ) , line : 5 } } as any as apiTypes . Breakpoint
413413 ] ;
414414
415415 breakpoints . forEach ( function ( bp : apiTypes . Breakpoint ) {
@@ -500,6 +500,25 @@ describe('v8debugapi', function() {
500500
501501 } ) ;
502502
503+ it ( 'should resolve actual line number hit rather than originally set' , function ( done ) {
504+ const bp : apiTypes . Breakpoint = {
505+ id : 'fake-id-124' ,
506+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 4 }
507+ } as any as apiTypes . Breakpoint ;
508+ api . set ( bp , function ( err ) {
509+ assert . ifError ( err ) ;
510+ api . wait ( bp , function ( err ) {
511+ assert . ifError ( err ) ;
512+ assert . equal ( ( bp . location as apiTypes . SourceLocation ) . line , 5 ) ;
513+ api . clear ( bp , function ( err ) {
514+ assert . ifError ( err ) ;
515+ done ( ) ;
516+ } ) ;
517+ } )
518+ process . nextTick ( function ( ) { code . foo ( 1 ) ; } ) ;
519+ } ) ;
520+ } ) ;
521+
503522 it ( 'should work with multiply hit breakpoints' , function ( done ) {
504523 const oldWarn = logger . warn ;
505524 let logCount = 0 ;
@@ -713,7 +732,7 @@ describe('v8debugapi', function() {
713732 id : 'fake-id-124' ,
714733 // TODO: This path can be lest strict when this file has been
715734 // converted to Typescript.
716- location : { path : 'build/test/test-v8debugapi-code.js' , line : 9 } ,
735+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 10 } ,
717736 expressions : [ 'process.env' , 'hasGetter' ]
718737 } as any as apiTypes . Breakpoint ;
719738 const oldMaxData = config . capture . maxDataSize ;
@@ -767,7 +786,7 @@ describe('v8debugapi', function() {
767786 id : breakpointInFoo . id ,
768787 // TODO: This path can be lest strict when this file has been
769788 // converted to Typescript.
770- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
789+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
771790 expressions : [ 'A' ]
772791 } as any as apiTypes . Breakpoint ;
773792 api . set ( bp , function ( err ) {
@@ -808,7 +827,7 @@ describe('v8debugapi', function() {
808827 id : 'fake-id-124' ,
809828 // TODO: This path can be lest strict when this file has been
810829 // converted to Typescript.
811- location : { path : 'build/test/test-v8debugapi-code.js' , line : 9 }
830+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 10 }
812831 } as any as apiTypes . Breakpoint ;
813832 const oldMaxLength = config . capture . maxStringLength ;
814833 const oldMaxData = config . capture . maxDataSize ;
@@ -851,7 +870,7 @@ describe('v8debugapi', function() {
851870 id : 'fake-id-124' ,
852871 // TODO: This path can be lest strict when this file has been
853872 // converted to Typescript.
854- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 }
873+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 }
855874 } as any as apiTypes . Breakpoint ;
856875 const oldMax = config . capture . maxProperties ;
857876 config . capture . maxProperties = 1 ;
@@ -887,7 +906,7 @@ describe('v8debugapi', function() {
887906 id : 'fake-id-124' ,
888907 // TODO: This path can be lest strict when this file has been
889908 // converted to Typescript.
890- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 }
909+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 }
891910 } as any as apiTypes . Breakpoint ;
892911 const oldMax = config . capture . maxProperties ;
893912 config . capture . maxProperties = 1 ;
@@ -923,7 +942,7 @@ describe('v8debugapi', function() {
923942 id : 'fake-id-124' ,
924943 // TODO: This path can be lest strict when this file has been
925944 // converted to Typescript.
926- location : { path : 'build/test/test-v8debugapi-code.js' , line : 9 } ,
945+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 10 } ,
927946 expressions : [ 'hasGetter' ]
928947 } as any as apiTypes . Breakpoint ;
929948 const oldMaxLength = config . capture . maxStringLength ;
@@ -965,7 +984,7 @@ describe('v8debugapi', function() {
965984 id : 'fake-id-124' ,
966985 // TODO: This path can be lest strict when this file has been
967986 // converted to Typescript.
968- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
987+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
969988 expressions : [ 'A' ]
970989 } as any as apiTypes . Breakpoint ;
971990 const oldMaxProps = config . capture . maxProperties ;
@@ -1004,7 +1023,7 @@ describe('v8debugapi', function() {
10041023 id : 'fake-id-124' ,
10051024 // TODO: This path can be lest strict when this file has been
10061025 // converted to Typescript.
1007- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
1026+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
10081027 expressions : [ 'B' ]
10091028 } as any as apiTypes . Breakpoint ;
10101029 const oldMaxProps = config . capture . maxProperties ;
@@ -1042,7 +1061,7 @@ describe('v8debugapi', function() {
10421061 id : 'fake-id-124' ,
10431062 // TODO: This path can be lest strict when this file has been
10441063 // converted to Typescript.
1045- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
1064+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
10461065 expressions : [ 'A' ]
10471066 } as any as apiTypes . Breakpoint ;
10481067 const oldMaxProps = config . capture . maxProperties ;
@@ -1081,7 +1100,7 @@ describe('v8debugapi', function() {
10811100 id : 'fake-id-124' ,
10821101 // TODO: This path can be lest strict when this file has been
10831102 // converted to Typescript.
1084- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
1103+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
10851104 expressions : [ 'B' ]
10861105 } as any as apiTypes . Breakpoint ;
10871106 const oldMaxProps = config . capture . maxProperties ;
@@ -1120,7 +1139,7 @@ describe('v8debugapi', function() {
11201139 id : 'fake-id-124' ,
11211140 // TODO: This path can be lest strict when this file has been
11221141 // converted to Typescript.
1123- location : { path : 'build/test/test-v8debugapi-code.js' , line : 5 } ,
1142+ location : { path : 'build/test/test-v8debugapi-code.js' , line : 6 } ,
11241143 expressions : [ 'A' ]
11251144 } as any as apiTypes . Breakpoint ;
11261145 const oldMaxProps = config . capture . maxProperties ;
@@ -1399,9 +1418,9 @@ describe('v8debugapi', function() {
13991418 it ( 'should be possible to set multiple breakpoints at once' ,
14001419 function ( done ) {
14011420 // TODO: Have this actually implement Breakpoint
1402- const bp1 : apiTypes . Breakpoint = { id : 'bp1' , location : { path : __filename , line : 4 } } as any as apiTypes . Breakpoint ;
1421+ const bp1 : apiTypes . Breakpoint = { id : 'bp1' , location : { path : __filename , line : 5 } } as any as apiTypes . Breakpoint ;
14031422 // TODO: Have this actually implement Breakpoint
1404- const bp2 : apiTypes . Breakpoint = { id : 'bp2' , location : { path : __filename , line : 5 } } as any as apiTypes . Breakpoint ;
1423+ const bp2 : apiTypes . Breakpoint = { id : 'bp2' , location : { path : __filename , line : 6 } } as any as apiTypes . Breakpoint ;
14051424 api . set ( bp1 , function ( err ) {
14061425 assert . ifError ( err ) ;
14071426 api . set ( bp2 , function ( err ) {
0 commit comments