Problem
Running cargo test --test gui fails completely on Windows machines. I dug into tests/gui/runner.rs and found three distinct Windows-specific issues preventing the headless browser tests from running:
1. npm and npx commands not found
Rust's Command::new("npm") fails on Windows because the executables are actually batch files (npm.cmd).
2. Drive letters break the version parser
The parser does l.split(':').nth(1) expecting the version after the first :. However, Windows paths have a drive letter (e.g., V:\), so nth(1) returns the path segment instead of the version. This causes the browser-ui-test version check to panic with "not installed".
3. Backslash separators break DOC_PATH in redirect tests
out_dir.display() on Windows returns backslashes (V:\coding\...). The headless browser receives file://V:\coding\... but reports file:///V:/coding/... — causing redirect.goml to fail on every run due to a string mismatch.
Expected Behavior
Running cargo test --test gui should execute the test suite locally on Windows machines without panicking on OS-specific pathing or command formatting.
Steps
- On a Windows machine with Rust and Node/npm installed, clone the repository.
- Run
npm install in the root directory.
- Run
cargo test --test gui.
- Result: Immediate panic on
npm command not found. (If patched manually, it subsequently panics on the version parser, and then fails the redirect test).
Possible Solution(s)
1. Add a helper for Windows .cmd resolution:
fn npm_cmd(name: &str) -> Command {
if cfg!(windows) {
let mut cmd = Command::new("cmd");
cmd.args(["/C", &format!("{}.cmd", name)]);
cmd
} else {
Command::new(name)
}
}
Use npm_cmd("npm") and npm_cmd("npx") in place of
Command::new("npm") / Command::new("npx").
2. Fix drive letter breaking version parse:
Change nth(1) to last() so it grabs the version string
regardless of drive letters.
l.split(':').last()?.strip_prefix("browser-ui-test@")
3. Fix path separators in DOC_PATH:
Normalize slashes before formatting the file URI.
let out_dir_str = out_dir.display().to_string().replace('\\', "/");
let mut doc_path = format!("file:///{}", out_dir_str);
Notes
- Environment: Windows 11, PowerShell, Rust stable (msvc), Node 24, npm 10.
- Willingness to contribute: I have all three fixes working locally. All 19 GUI tests pass flawlessly on my Windows machine after applying these changes. I am happy to submit a PR if this is something the team would like addressed!
Version
Problem
Running
cargo test --test guifails completely on Windows machines. I dug intotests/gui/runner.rsand found three distinct Windows-specific issues preventing the headless browser tests from running:1.
npmandnpxcommands not foundRust's
Command::new("npm")fails on Windows because the executables are actually batch files (npm.cmd).2. Drive letters break the version parser
The parser does
l.split(':').nth(1)expecting the version after the first:. However, Windows paths have a drive letter (e.g.,V:\), sonth(1)returns the path segment instead of the version. This causes thebrowser-ui-testversion check to panic with "not installed".3. Backslash separators break
DOC_PATHin redirect testsout_dir.display()on Windows returns backslashes (V:\coding\...). The headless browser receivesfile://V:\coding\...but reportsfile:///V:/coding/...— causingredirect.gomlto fail on every run due to a string mismatch.Expected Behavior
Running
cargo test --test guishould execute the test suite locally on Windows machines without panicking on OS-specific pathing or command formatting.Steps
npm installin the root directory.cargo test --test gui.npm command not found. (If patched manually, it subsequently panics on the version parser, and then fails the redirect test).Possible Solution(s)
1. Add a helper for Windows
.cmdresolution:Use
npm_cmd("npm")andnpm_cmd("npx")in place ofCommand::new("npm")/Command::new("npx").2. Fix drive letter breaking version parse:
Change
nth(1)tolast()so it grabs the version stringregardless of drive letters.
3. Fix path separators in
DOC_PATH:Normalize slashes before formatting the file URI.
Notes
Version