@@ -97,13 +97,17 @@ describe('StackTrace', function () {
9797
9898 it ( 'uses source maps to enhance stack frames' , function ( ) {
9999 runs ( function ( ) {
100- var sourceMin = 'var foo= function(){};function bar(){ }var baz=eval("XXX" );\n//@ sourceMappingURL=test .js.map' ;
101- var sourceMap = '{"version":3,"sources":["./test. js"],"names":["foo ","bar ","baz","eval" ],"mappings":"AAAA,GAAIA,KAAM,YACV,SAASC,QACT,GAAIC,KAAMC,KAAK","file":"test.min.js "}' ;
102- server . respondWith ( 'GET' , 'http://path/to/file.js' , [ 200 , { 'Content-Type' : 'application/x-javascript' } , sourceMin ] ) ;
103- server . respondWith ( 'GET' , 'test .js.map' , [ 200 , { 'Content-Type' : 'application/json' } , sourceMap ] ) ;
100+ var sourceMin = 'function increment (){someVariable+=2;null.x() }var someVariable=2;increment( );\n//# sourceMappingURL=file.min .js.map' ;
101+ var sourceMap = '{"version":3,"file":"file.min.js"," sources":["file. js"],"names":["increment ","someVariable ","x" ],"mappings":"AAAA,QAASA,aACLC,cAAgB,CAChB,MAAKC,IAET,GAAID,cAAe,CACnBD "}' ;
102+ server . respondWith ( 'GET' , 'http://path/to/file.min. js' , [ 200 , { 'Content-Type' : 'application/x-javascript' } , sourceMin ] ) ;
103+ server . respondWith ( 'GET' , 'http://path/to/file.min .js.map' , [ 200 , { 'Content-Type' : 'application/json' } , sourceMap ] ) ;
104104
105- var stack = 'TypeError: Unable to get property \'undef\' of undefined or null reference\n at foo (http://path/to/file.js:45:13)' ;
106- StackTrace . fromError ( { stack : stack } ) . then ( callback , errback ) [ 'catch' ] ( errback ) ;
105+ var stack = 'TypeError: Cannot read property \'x\' of null\n at increment (http://path/to/file.min.js:1:38)' ;
106+ StackTrace . fromError ( { stack : stack } ) . then ( callback , debugErrback ) [ 'catch' ] ( debugErrback ) ;
107+ server . respond ( ) ;
108+ } ) ;
109+ waits ( 100 ) ;
110+ runs ( function ( ) {
107111 server . respond ( ) ;
108112 } ) ;
109113 waits ( 100 ) ;
@@ -115,7 +119,7 @@ describe('StackTrace', function () {
115119 expect ( callback ) . toHaveBeenCalled ( ) ;
116120 var stackFrames = callback . mostRecentCall . args [ 0 ] ;
117121 expect ( stackFrames . length ) . toEqual ( 1 ) ;
118- expect ( stackFrames [ 0 ] ) . toMatchStackFrame ( [ 'foo ' , undefined , 'http://path/to/ file.js' , 45 , 13 ] ) ;
122+ expect ( stackFrames [ 0 ] ) . toMatchStackFrame ( [ 'null ' , undefined , 'file.js' , 3 , 4 ] ) ;
119123 expect ( errback ) . not . toHaveBeenCalled ( ) ;
120124 } ) ;
121125 } ) ;
0 commit comments