File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/tinybench-plugin/src Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { findUpSync, Options } from "find-up";
3
3
import path , { dirname } from "path" ;
4
4
import { get as getStackTrace } from "stack-trace" ;
5
5
import { Bench } from "tinybench" ;
6
+ import { fileURLToPath } from "url" ;
6
7
7
8
declare const __VERSION__ : string ;
8
9
@@ -37,11 +38,14 @@ export function withCodSpeed(bench: Bench): Bench {
37
38
38
39
function getCallingFile ( ) : string {
39
40
const stack = getStackTrace ( ) ;
40
- const callingFile = stack [ 2 ] . getFileName ( ) ; // [here, withCodSpeed, actual caller]
41
+ let callingFile = stack [ 2 ] . getFileName ( ) ; // [here, withCodSpeed, actual caller]
41
42
const gitDir = getGitDir ( callingFile ) ;
42
43
if ( gitDir === undefined ) {
43
44
throw new Error ( "Could not find a git repository" ) ;
44
45
}
46
+ if ( callingFile . startsWith ( "file://" ) ) {
47
+ callingFile = fileURLToPath ( callingFile ) ;
48
+ }
45
49
return path . relative ( gitDir , callingFile ) ;
46
50
}
47
51
You can’t perform that action at this time.
0 commit comments