Skip to content

Commit b6f5b11

Browse files
committed
test: use file URL when importing loader in subprocess
1 parent 97ded7d commit b6f5b11

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/nuxt-cli/test/unit/utils/nuxt-config.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { mkdtemp, writeFile } from 'node:fs/promises'
33
import { tmpdir } from 'node:os'
44
import { join } from 'node:path'
55
import process from 'node:process'
6-
import { fileURLToPath } from 'node:url'
6+
77
import { promisify } from 'node:util'
88

99
import { describe, expect, it } from 'vitest'
1010

1111
const execFileAsync = promisify(execFile)
1212

13-
const loaderPath = fileURLToPath(new URL('../../../src/utils/nuxt-config.ts', import.meta.url))
13+
const loaderUrl = new URL('../../../src/utils/nuxt-config.ts', import.meta.url).href
1414

1515
/**
1616
* `getNuxtConfig` picks between Node's own loader and `jiti` by inspecting the
@@ -25,7 +25,7 @@ async function loadConfig(files: Record<string, string>) {
2525
}
2626

2727
const script = `
28-
const { getNuxtConfig } = await import(${JSON.stringify(loaderPath)})
28+
const { getNuxtConfig } = await import(${JSON.stringify(loaderUrl)})
2929
process.stdout.write(JSON.stringify(await getNuxtConfig(${JSON.stringify(cwd)})))
3030
`
3131
const { stdout, stderr } = await execFileAsync(process.execPath, ['--input-type=module', '--eval', script], { cwd })

0 commit comments

Comments
 (0)