Skip to content

Commit 4a05d6a

Browse files
wan9chiclaude
andcommitted
fix(ci): make vite_task_server integration tests use platform-specific abs paths
On Windows, forward-slash paths without a drive letter (`/tmp/x.txt`) are RELATIVE, so the client's `resolve_path` joined them with the cwd (`D:\...\tmp\x.txt`) and the server-side assertion blew up. Use `/tmp/` on unix and `C:\tmp\` on windows so the paths are absolute on each platform and reach the server unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d0d6578 commit 4a05d6a

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

crates/vite_task_server/tests/integration.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,27 @@ fn send_frame(stream: &mut Stream, request: &Request<'_>) {
8484

8585
#[test]
8686
fn single_client_fire_and_forget() {
87+
// Absolute paths look different on each platform; bare forward-slash
88+
// paths are relative on Windows (no drive letter) and would be rewritten
89+
// by the client before the server sees them.
90+
#[cfg(unix)]
91+
let (in_path, out_path) = ("/tmp/in.txt", "/tmp/out.txt");
92+
#[cfg(windows)]
93+
let (in_path, out_path) = (r"C:\tmp\in.txt", r"C:\tmp\out.txt");
94+
8795
let reports = run_with_server(env_map(&[]), |envs| {
8896
let client = connect(&envs);
89-
client.ignore_input(OsStr::new("/tmp/in.txt")).unwrap();
90-
client.ignore_output(OsStr::new("/tmp/out.txt")).unwrap();
97+
client.ignore_input(OsStr::new(in_path)).unwrap();
98+
client.ignore_output(OsStr::new(out_path)).unwrap();
9199
client.disable_cache().unwrap();
92100
flush(&client);
93101
})
94102
.expect("driver returned error");
95103

96104
let inputs: Vec<_> = reports.ignored_inputs.iter().map(|p| p.as_path().as_os_str()).collect();
97105
let outputs: Vec<_> = reports.ignored_outputs.iter().map(|p| p.as_path().as_os_str()).collect();
98-
assert_eq!(inputs, vec![OsStr::new("/tmp/in.txt")]);
99-
assert_eq!(outputs, vec![OsStr::new("/tmp/out.txt")]);
106+
assert_eq!(inputs, vec![OsStr::new(in_path)]);
107+
assert_eq!(outputs, vec![OsStr::new(out_path)]);
100108
assert!(reports.cache_disabled);
101109
}
102110

@@ -139,7 +147,10 @@ fn get_env_tracked_upgrade_is_monotonic() {
139147

140148
#[test]
141149
fn concurrent_clients() {
150+
#[cfg(unix)]
142151
let paths = ["/tmp/worker_0", "/tmp/worker_1", "/tmp/worker_2", "/tmp/worker_3"];
152+
#[cfg(windows)]
153+
let paths = [r"C:\tmp\worker_0", r"C:\tmp\worker_1", r"C:\tmp\worker_2", r"C:\tmp\worker_3"];
143154
let reports = run_with_server(env_map(&[("SHARED", "value")]), move |envs| {
144155
let threads: Vec<_> = paths
145156
.iter()

0 commit comments

Comments
 (0)