@@ -18,7 +18,8 @@ import type {
18
18
import { promises as fs } from 'node:fs'
19
19
import { rm } from 'node:fs/promises'
20
20
import { tmpdir } from 'node:os'
21
- import { deepMerge , nanoid } from '@vitest/utils'
21
+ import path from 'node:path'
22
+ import { deepMerge , nanoid , slash } from '@vitest/utils'
22
23
import fg from 'fast-glob'
23
24
import mm from 'micromatch'
24
25
import {
@@ -27,7 +28,6 @@ import {
27
28
join ,
28
29
relative ,
29
30
resolve ,
30
- toNamespacedPath ,
31
31
} from 'pathe'
32
32
import { ViteNodeRunner } from 'vite-node/client'
33
33
import { ViteNodeServer } from 'vite-node/server'
@@ -302,7 +302,10 @@ export class WorkspaceProject {
302
302
}
303
303
304
304
const files = await fg ( include , globOptions )
305
- return files . map ( file => resolve ( cwd , file ) )
305
+ // keep the slashes consistent with Vite
306
+ // we are not using the pathe here because it normalizes the drive letter on Windows
307
+ // and we want to keep it the same as working dir
308
+ return files . map ( file => slash ( path . resolve ( cwd , file ) ) )
306
309
}
307
310
308
311
async isTargetFile ( id : string , source ?: string ) : Promise < boolean > {
@@ -329,7 +332,7 @@ export class WorkspaceProject {
329
332
330
333
filterFiles ( testFiles : string [ ] , filters : string [ ] , dir : string ) {
331
334
if ( filters . length && process . platform === 'win32' ) {
332
- filters = filters . map ( f => toNamespacedPath ( f ) )
335
+ filters = filters . map ( f => slash ( f ) )
333
336
}
334
337
335
338
if ( filters . length ) {
0 commit comments