@@ -143,7 +143,7 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
143143
144144 const includeFile = `test262/harness/${ includeName } ` ;
145145 const includeCode = fs . readFileSync ( includeFile , UTF8 ) ;
146- const include = new vm . Script ( includeCode ) ;
146+ const include = new vm . Script ( includeCode , { filename : path . resolve ( includeFile ) } ) ;
147147
148148 helpersCache . set ( includeName , include ) ;
149149 return include ;
@@ -235,7 +235,18 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
235235 polyfill . runInContext ( testContext ) ;
236236
237237 // To proceed, we will now need to read the frontmatter
238- const testCode = fs . readFileSync ( testFile , UTF8 ) ;
238+ let testCode = fs . readFileSync ( testFile , UTF8 ) ;
239+ // Various forms of the test's path and filename. testRelPath matches what
240+ // is given in the expected failures file. testDisplayName is a slightly
241+ // abbreviated form that we use in logging during the run to make it more
242+ // likely to fit on one line. progressDisplayName is what's displayed beside
243+ // the progress bar: testDisplayName with the actual test filename cut off,
244+ // since the individual tests go by too fast to read anyway.
245+ const testRelPath = path . relative ( testSubdirectory , testFile ) ;
246+
247+ // Include a sourceURL so that when tests are run in a debugger they can be
248+ // found using the names listed in the expected-failures-style files.
249+ testCode += `\n//# sourceURL=${ testRelPath } ` ;
239250
240251 const frontmatterString = frontmatterMatcher . exec ( testCode ) ?. [ 1 ] ?? '' ;
241252 const frontmatter = yaml . load ( frontmatterString ) ;
@@ -250,13 +261,6 @@ export default function runTest262({ test262Dir, testGlobs, polyfillCodeFile, ex
250261 getHelperScript ( includeName ) . runInContext ( testContext ) ;
251262 } ) ;
252263
253- // Various forms of the test's path and filename. testRelPath matches what
254- // is given in the expected failures file. testDisplayName is a slightly
255- // abbreviated form that we use in logging during the run to make it more
256- // likely to fit on one line. progressDisplayName is what's displayed beside
257- // the progress bar: testDisplayName with the actual test filename cut off,
258- // since the individual tests go by too fast to read anyway.
259- const testRelPath = path . relative ( testSubdirectory , testFile ) ;
260264 const testDisplayName = testRelPath
261265 . replace ( 'built-ins/Temporal/' , '' )
262266 . replace ( 'intl402/Temporal/' , '(intl) ' )
0 commit comments