Skip to content

Oxlint plugin test fails on Windows before running #220

Description

@snowyukitty

Summary

On Windows, the oxlint plugin test exits before any RuleTester cases run because its dynamic import() receives an absolute filesystem path.

Reproduction

  1. Install dependencies with pnpm.
  2. Run node --test scripts/oxlint-plugin.test.js on Windows.

The process fails with:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'

I reproduced this with Node 22.22.3 and pnpm 11.17.0.

Cause

vitePlusRequire.resolve("oxlint/plugins-dev") returns an absolute filesystem path. On Windows, passing that path directly to import() makes the drive letter look like a URL scheme.

Converting the resolved path with Node's pathToFileURL() before importing allows all 32 existing test cases to run and pass, while remaining valid on POSIX platforms.

AI tools assisted the investigation and drafting. The failure and passing test result above were verified in the stated Windows environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions