@@ -262,6 +262,54 @@ Error: spec iframe stack
262262 ] )
263263 } )
264264
265+ it ( 'strips webpack protocol and maintains absolute path' , ( ) => {
266+ $sourceMapUtils . getSourcePosition . returns ( {
267+ file : 'cypress:////root/absolute/path/some_other_file.ts' ,
268+ line : 2 ,
269+ column : 1 ,
270+ } )
271+
272+ $sourceMapUtils . getSourcePosition . onCall ( 1 ) . returns ( {
273+ file : 'webpack:////root/absolute/path/cypress/integration/features/source_map_spec.coffee' ,
274+ line : 4 ,
275+ column : 3 ,
276+ } )
277+
278+ const sourceStack = $stackUtils . getSourceStack ( generatedStack , projectRoot )
279+
280+ expect ( sourceStack . sourceMapped ) . to . equal ( `Error: spec iframe stack
281+ at foo.bar (cypress:////root/absolute/path/some_other_file.ts:2:2)
282+ at Context.<anonymous> (webpack:////root/absolute/path/cypress/integration/features/source_map_spec.coffee:4:4)\
283+ ` )
284+
285+ expect ( sourceStack . parsed ) . to . eql ( [
286+ {
287+ message : 'Error: spec iframe stack' ,
288+ whitespace : '' ,
289+ } ,
290+ {
291+ function : 'foo.bar' ,
292+ fileUrl : 'http://localhost:1234/source_map_spec.js' ,
293+ originalFile : 'cypress:////root/absolute/path/some_other_file.ts' ,
294+ relativeFile : '/root/absolute/path/some_other_file.ts' ,
295+ absoluteFile : '/root/absolute/path/some_other_file.ts' ,
296+ line : 2 ,
297+ column : 2 ,
298+ whitespace : ' ' ,
299+ } ,
300+ {
301+ function : 'Context.<anonymous>' ,
302+ fileUrl : 'http://localhost:1234/tests?p=cypress/integration/features/source_map_spec.js' ,
303+ originalFile : 'webpack:////root/absolute/path/cypress/integration/features/source_map_spec.coffee' ,
304+ relativeFile : '/root/absolute/path/cypress/integration/features/source_map_spec.coffee' ,
305+ absoluteFile : '/root/absolute/path/cypress/integration/features/source_map_spec.coffee' ,
306+ line : 4 ,
307+ column : 4 ,
308+ whitespace : ' ' ,
309+ } ,
310+ ] )
311+ } )
312+
265313 it ( 'returns empty object if there\'s no stack' , ( ) => {
266314 expect ( $stackUtils . getSourceStack ( ) ) . to . eql ( { } )
267315 } )
0 commit comments