Skip to content

Commit ccd4894

Browse files
committed
test(components): fix path expectations on windows
1 parent 6bcc97a commit ccd4894

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/utils/components.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, expect, afterAll, vi } from 'vitest'
22
import { consola } from 'consola'
33
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, realpathSync } from 'node:fs'
44
import { tmpdir } from 'node:os'
5-
import { join } from 'node:path'
5+
import { join, normalize } from 'pathe'
66
import { detectUsedComponents, resolveExtraScanDirs } from '../../src/utils/components'
77

88
const componentDir = join(process.cwd(), 'src/runtime/components')
@@ -17,9 +17,10 @@ function fixtureUsing(markup: string) {
1717
}
1818

1919
// `realpathSync` because module resolution returns real paths and macOS puts
20-
// `tmpdir()` behind a `/private` symlink.
20+
// `tmpdir()` behind a `/private` symlink. `normalize` because it returns
21+
// backslashes on Windows while `resolveExtraScanDirs` emits forward slashes.
2122
function fixtureRoot() {
22-
const dir = realpathSync(mkdtempSync(join(tmpdir(), 'nuxt-ui-cd-')))
23+
const dir = normalize(realpathSync(mkdtempSync(join(tmpdir(), 'nuxt-ui-cd-'))))
2324
fixtureDirs.push(dir)
2425
return dir
2526
}

0 commit comments

Comments
 (0)