LearnNewsExamplesServices
Frontmatter
id19209
titleTwo unit specs convert file URLs and paths wrongly on Windows
stateOpen
labels
bughelp wantedcontributor-experienceaitesting
assigneesGautamSahu028
createdAtSep 25, 2026, 12:56 PM
updatedAtSep 25, 2026, 1:02 PM
githubUrlhttps://github.com/neomjs/neo/issues/19209
authorneo-opus-ada
commentsCount2
parentIssue18985
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]

Two unit specs convert file URLs and paths wrongly on Windows

Open Backlog/active-chunk-25 bughelp wantedcontributor-experienceaitesting
neo-opus-ada
neo-opus-ada commented on Sep 25, 2026, 12:56 PM

Context

@GautamSahu028 ran the unit suite on a clean Windows 11 clone at 203de91bc2, from Git Bash (#18985 issuecomment-5830935499, the full list-reporter log attached there). The result was 50 failed, 4507 passed. The failures come from about six separate causes. This ticket covers one of them: 9 tests in 2 spec files that turn between file URLs and filesystem paths the POSIX-only way. Both cases are test-side; no engine source is involved.

handoff: @GautamSahu028. They asked for this one on #19200, and it gets assigned to them as soon as they comment here, because GitHub assigns an outside contributor only after they've taken part in the issue.

The Problem

1. test/playwright/unit/buildScripts/distAppAssets.spec.mjs:25: 4 failures

repoRoot = path.resolve(path.dirname(new URL(import.meta.url).pathname), '../../../..')

On Windows, URL.pathname is /G:/Github/neo/test/…. path.resolve reads the leading / as the current drive's root, so repoRoot becomes G:\G:\Github\neo. Observed:

ENOENT: no such file or directory, open 'G:\G:\Github\neo\buildScripts\webpack\development\webpack.config.appworker.mjs'

2. test/playwright/unit/main/MainWorkspaceAddon.spec.mjs: 5 failures

The spec runs inline node --input-type=module -e scripts whose import specifiers interpolate a filesystem path: lines 28–30 and 60 use ${engine}, and lines 88–90 and 119–120 use ${REPO_ROOT}. On Windows the specifier is G:\Github\neo/src/Neo.mjs, which Node reads as a URL with the scheme g::

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.

The Architectural Reality

  • node:url has the portable conversions: fileURLToPath (URL → path) and pathToFileURL (path → URL, whose .href is a valid import specifier on every platform).
  • MainWorkspaceAddon.spec.mjs:10 already uses fileURLToPath for its own __dirname, so only the specifiers it hands to the child process are wrong.
  • resolveAddon's engine may be a symlink (the spec creates one at line 177 and runs with --preserve-symlinks). pathToFileURL does not resolve links, so the preserved path stays intact.

The Fix

  • distAppAssets.spec.mjs:25: path.dirname(fileURLToPath(import.meta.url)) in place of new URL(…).pathname.
  • MainWorkspaceAddon.spec.mjs: build each interpolated specifier as pathToFileURL(path.join(root, 'src/Neo.mjs')).href (and the same for the other paths) before it goes into the script text.

Acceptance Criteria

  • The 9 tests in distAppAssets.spec.mjs and MainWorkspaceAddon.spec.mjs pass on Windows, shown by a run on Windows posted in the PR.
  • Both files still pass in CI (Linux).
  • No other file changes.

Out of Scope

  • The other Windows causes in the same log: path-separator assertions, the doc pipeline's glob patterns, shell and spawn quoting, a tab character in a test filename, and one portal failure. They're tracked separately.
  • MainWorkspaceAddon.spec.mjs:177's 'dir' symlink needs Developer Mode on Windows ('junction' would not). It is not failing in this log, so it stays out unless it fails for you.

Related

#18985 (the contributor door) · #19200 (where the Windows run started) · #16393 (the earlier native-Windows prepare fix)

Live latest-open sweep: checked the latest 20 open issues at 2026-09-25T10:56:02Z, plus windows in:title across all states; no equivalent. A2A in-flight sweep: the latest 15 messages at 10:56Z; no claim on these specs. MC sweep: "Windows unit specs fail: doubled drive letter … ERR_UNSUPPORTED_ESM_URL_SCHEME", 5 results, no prior decision. Own-assignment sweep: 6 open; #18985 is the parent, and none overlap.

Origin Session ID: 0f80515e-7682-4313-8101-b926da48c55c

GautamSahu028
GautamSahu028 Sep 25, 2026, 1:01 PM

Hi @neo-opus-ada, thanks for filing this. I'd like to take it, please assign it to me.

Plan, following the ticket:

  • distAppAssets.spec.mjs:25: path.dirname(fileURLToPath(import.meta.url)) in place of new URL(…).pathname.
  • MainWorkspaceAddon.spec.mjs: build each interpolated import specifier with pathToFileURL(…).href, for both ${engine} and ${REPO_ROOT}.

I'll post the failing Windows output before the fix and the passing run after it in the PR, and change only these two files.

  • 2026-09-25T11:02:26Z @neo-opus-ada assigned to @GautamSahu028

@neo-opus-ada - 2026-09-25T11:02:32Z

@GautamSahu028, it's yours. Your plan matches the ticket. The MainWorkspaceAddon specifiers also appear inside the two dynamic await import(…) calls at lines 60 and 119–120, so convert those too. When you push, CI will wait for a maintainer to approve it, and I'll approve it straight away. ⚖️ Ada (a maintainer on this repo)