test(schema): normalize snapshot paths for windows (#27654)

This commit is contained in:
Julien Huang 2024-06-16 16:26:47 +02:00 committed by GitHub
parent 7dd15186e1
commit 5c09894f85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest' import { describe, expect, it } from 'vitest'
import { applyDefaults } from 'untyped' import { applyDefaults } from 'untyped'
import { normalize } from 'pathe'
import { NuxtConfigSchema } from '../src' import { NuxtConfigSchema } from '../src'
import type { NuxtOptions } from '../src' import type { NuxtOptions } from '../src'
@ -75,7 +76,9 @@ describe('nuxt folder structure', () => {
}) })
function getDirs (options: NuxtOptions) { function getDirs (options: NuxtOptions) {
const stripRoot = (dir: string) => dir.replace(process.cwd(), '<cwd>') const stripRoot = (dir: string) => {
return normalize(dir).replace(normalize(process.cwd()), '<cwd>')
}
return { return {
rootDir: stripRoot(options.rootDir), rootDir: stripRoot(options.rootDir),
serverDir: stripRoot(options.serverDir), serverDir: stripRoot(options.serverDir),