File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/benchmark.js-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 @@ -8,6 +8,7 @@ import Benchmark from "benchmark";
8
8
import { findUpSync , Options as FindupOptions } from "find-up" ;
9
9
import path , { dirname } from "path" ;
10
10
import { get as getStackTrace } from "stack-trace" ;
11
+ import { fileURLToPath } from "url" ;
11
12
12
13
declare const __VERSION__ : string ;
13
14
@@ -201,11 +202,14 @@ async function runBenchmarks({
201
202
202
203
function getCallingFile ( ) : string {
203
204
const stack = getStackTrace ( ) ;
204
- const callingFile = stack [ 3 ] . getFileName ( ) ; // [here, withCodSpeed, withCodSpeedX, actual caller]
205
+ let callingFile = stack [ 3 ] . getFileName ( ) ; // [here, withCodSpeed, withCodSpeedX, actual caller]
205
206
const gitDir = getGitDir ( callingFile ) ;
206
207
if ( gitDir === undefined ) {
207
208
throw new Error ( "Could not find a git repository" ) ;
208
209
}
210
+ if ( callingFile . startsWith ( "file://" ) ) {
211
+ callingFile = fileURLToPath ( callingFile ) ;
212
+ }
209
213
return path . relative ( gitDir , callingFile ) ;
210
214
}
211
215
You can’t perform that action at this time.
0 commit comments