Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows, running tests throws error "TypeError: The URL must be of scheme file" #1050

Open
naturalprogrammer opened this issue Dec 25, 2024 · 2 comments

Comments

@naturalprogrammer
Copy link

Environment

Windows (11 Pro), NodeJS v22.12.0

Reproduction

https://github.com/naturalprogrammer/np-nuxt-test-sample

Describe the bug

When I run npm run test on Windows, I get the following output:

 FAIL  tests/app.test.ts [ tests/app.test.ts ]
TypeError: The URL must be of scheme file
 ❯ node_modules/@nuxt/test-utils/dirs.js:4:17

 ❯ node_modules/@nuxt/test-utils/dist/e2e.mjs:4:31

As a temporary fix, I'd update node_modules/@nuxt/test-utils/dirs.js as below:

import { fileURLToPath } from 'node:url'
import { dirname } from 'path'

// Fix for Windows path resolution
export const distDir = dirname(fileURLToPath(import.meta.url)) + '/dist'

Additional context

No response

Logs

@mcrapts
Copy link

mcrapts commented Dec 26, 2024

I have the same issue, but in Linux (not Windows). Happened after upgrading Nuxt from 3.14 to 3.15.

@scottbedard
Copy link

Duplicate #1038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants