Skip to content

fix(runner): import resolved packages via file:// URLs on win32 - #1429

Merged
Chase J (chajac) merged 1 commit into
mainfrom
windows-import-file-urls
Jul 31, 2026
Merged

fix(runner): import resolved packages via file:// URLs on win32#1429
Chase J (chajac) merged 1 commit into
mainfrom
windows-import-file-urls

Conversation

@chajac

@chajac Chase J (chajac) commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes WIZ-11313.

Problem

qawolf flows run on Windows fails with:

Could not load @qawolf/testkit ... 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 'c:'

The npm-installed CLI runs under Node, and import() treats its argument as a URL, not a filesystem path. POSIX paths happen to parse as URL paths, but a Windows path (C:\...) parses as URL protocol c:, which Node's ESM loader rejects. Four call sites passed raw resolveFromEnvDir()/join() paths to import(): the testkit loader (both imports — the reported failure), the Playwright loader, and the emails loader.

Fix

New src/shell/importFromPath.ts converts an absolute path to a file:// URL via pathToFileURL before importing; all four sites now use it. Same-module-instance semantics are unchanged on POSIX (Node keys its ESM cache by the resolved file:// URL, which is identical for both forms), so the shared-AsyncLocalStorage invariant holds.

Regression guard

The windows-smoke CI job gains a smoke that bundles the real src/shell/testkit.ts and drives configureTestkit under Node on win32 against a fixture @qawolf/testkit — red on the previous code (Received protocol 'c:'), green with the fix. Only Node-on-win32 rejects raw absolute-path specifiers, so only that job can catch a regression here.

Testing

  • Full suite (1260 tests), lint, format, typecheck, knip pass
  • Smoke passes under Node 24 on darwin; mechanism repro confirmed (import("C:\\temp\\x.js") throws ERR_UNSUPPORTED_ESM_URL_SCHEME on any platform)
  • Verified working on a win 11 machine to launch and pass a web test

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title follows Conventional Commits, uses an allowed type and scope, stays under 72 characters, and clearly describes the Windows file URL import fix.
Description check ✅ Passed The description clearly explains the problem, fix, regression coverage, and testing results, despite omitting the template headings and checklist.

Comment @coderabbitai help to get the list of available commands.

@chajac
Chase J (chajac) marked this pull request as ready for review July 31, 2026 18:59
@chajac
Chase J (chajac) merged commit 4d97a87 into main Jul 31, 2026
7 checks passed
@chajac
Chase J (chajac) deleted the windows-import-file-urls branch July 31, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants