File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/vscode/src/worker Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 1+ import { pathToFileURL } from 'node:url' ;
12import { WebSocket } from 'ws' ;
23import type { WorkerInitData , WorkerRunTestData } from '../types' ;
34import { logger } from './logger' ;
45import { VscodeReporter } from './reporter' ;
56
67type CommonOptions = Parameters < typeof import ( '@rstest/core' ) . initCli > [ 0 ] ;
78
9+ // fix ESM import path issue on windows
10+ // Only URLs with a scheme in: file, data, and node are supported by the default ESM loader.
11+ const normalizeImportPath = ( path : string ) => {
12+ return pathToFileURL ( path ) . toString ( ) ;
13+ } ;
14+
815class Worker {
916 private ws : WebSocket ;
1017 public rstestPath ! : string ;
@@ -51,7 +58,7 @@ class Worker {
5158
5259 public async createRstest ( data : WorkerRunTestData ) {
5360 const rstestModule = ( await import (
54- this . rstestPath
61+ normalizeImportPath ( this . rstestPath )
5562 ) ) as typeof import ( '@rstest/core' ) ;
5663 logger . debug ( 'Loaded Rstest module' ) ;
5764 const { createRstest, initCli } = rstestModule ;
You can’t perform that action at this time.
0 commit comments