@@ -33,7 +33,7 @@ import type {
33
33
import type { Class } from 'type-fest' ;
34
34
35
35
const parseErrorStackRegExp =
36
- / a t (?< fn > \S + ) (?: .* ? ) ? \( ? (?< path > (?: \/ | f i l e : | \w : \\ ) .* ?) (?: \) | $ ) / i;
36
+ / a t (?: (? <fn > \S + ) ) ? (?: .* ? ) ? \( ? (?< path > (?: \/ | f i l e : | \w : \\ ) .* ?) (?: \) | $ ) / i;
37
37
38
38
const parseScriptFilepathRegExp =
39
39
/ ( \/ | \\ ) b a b e l - p l u g i n - t e s t e r ( \/ | \\ ) ( d i s t | s r c ) ( \/ | \\ ) ( i n d e x | p l u g i n - t e s t e r ) \. ( j | t ) s $ / ;
@@ -118,8 +118,8 @@ function pluginTester(options: PluginTesterOptions = {}) {
118
118
const globalContextExpectFnHasToMatchSnapshot = ( ( ) => {
119
119
try {
120
120
return globalContextHasExpectFn
121
- ? typeof expect ( undefined ) ?. toMatchSnapshot == 'function'
122
- : false ;
121
+ ? typeof expect ( undefined ) ?. toMatchSnapshot == 'function'
122
+ : false ;
123
123
} catch {
124
124
/* istanbul ignore next */
125
125
return false ;
@@ -328,7 +328,7 @@ function pluginTester(options: PluginTesterOptions = {}) {
328
328
process . cwd ( )
329
329
) ;
330
330
331
- debug2 ( 'plugin name inference succeeded : %O' , name ) ;
331
+ debug2 ( 'plugin name inference result : %O' , name ) ;
332
332
return name ;
333
333
} catch {
334
334
debug2 ( 'plugin name inference failed' ) ;
@@ -358,11 +358,16 @@ function pluginTester(options: PluginTesterOptions = {}) {
358
358
const { fn : functionName , path : filePath } =
359
359
line . match ( parseErrorStackRegExp ) ?. groups || { } ;
360
360
361
- return functionName && filePath
361
+ return filePath
362
362
? {
363
363
functionName,
364
364
// ? Paranoid just in case the script name/path has colons
365
- filePath : filePath . split ( ':' ) . slice ( 0 , - 2 ) . join ( ':' )
365
+ filePath : filePath
366
+ . split ( 'file://' )
367
+ . at ( - 1 ) !
368
+ . split ( ':' )
369
+ . slice ( 0 , - 2 )
370
+ . join ( ':' )
366
371
}
367
372
: undefined ;
368
373
} )
0 commit comments