Skip to content

Commit 6559f7f

Browse files
committed
Fix Windows CI: remove canonicalize from tests (causes UNC path issues)
1 parent 7777831 commit 6559f7f

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

  • crates/affected-cli/tests

crates/affected-cli/tests/cli.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,17 @@ fn test_cli_list_no_changes() {
143143
#[test]
144144
fn test_cli_list_with_changes() {
145145
let dir = tempfile::tempdir().unwrap();
146-
let root = std::fs::canonicalize(dir.path()).unwrap();
147-
setup_cargo_workspace(&root);
146+
setup_cargo_workspace(dir.path());
148147

149148
// Make a change
150149
std::fs::write(
151-
root.join("crates/core/src/lib.rs"),
150+
dir.path().join("crates/core/src/lib.rs"),
152151
"pub fn hello() { /* v2 */ }\n",
153152
)
154153
.unwrap();
155154
std::process::Command::new("git")
156155
.args(["add", "-A"])
157-
.current_dir(&root)
156+
.current_dir(dir.path())
158157
.output()
159158
.unwrap();
160159
std::process::Command::new("git")
@@ -167,13 +166,13 @@ fn test_cli_list_with_changes() {
167166
"-m",
168167
"change core",
169168
])
170-
.current_dir(&root)
169+
.current_dir(dir.path())
171170
.output()
172171
.unwrap();
173172

174173
affected_cmd()
175174
.args(["list", "--base", "HEAD~1", "--root"])
176-
.arg(&root)
175+
.arg(dir.path())
177176
.assert()
178177
.success()
179178
.stdout(predicate::str::contains("core"))
@@ -283,18 +282,17 @@ fn test_cli_test_dry_run_no_changes() {
283282
#[test]
284283
fn test_cli_ci_matrix_output() {
285284
let dir = tempfile::tempdir().unwrap();
286-
let root = std::fs::canonicalize(dir.path()).unwrap();
287-
setup_cargo_workspace(&root);
285+
setup_cargo_workspace(dir.path());
288286

289287
// Make a change to core
290288
std::fs::write(
291-
root.join("crates/core/src/lib.rs"),
289+
dir.path().join("crates/core/src/lib.rs"),
292290
"pub fn hello() { /* ci-test */ }\n",
293291
)
294292
.unwrap();
295293
std::process::Command::new("git")
296294
.args(["add", "-A"])
297-
.current_dir(&root)
295+
.current_dir(dir.path())
298296
.output()
299297
.unwrap();
300298
std::process::Command::new("git")
@@ -307,13 +305,13 @@ fn test_cli_ci_matrix_output() {
307305
"-m",
308306
"change core",
309307
])
310-
.current_dir(&root)
308+
.current_dir(dir.path())
311309
.output()
312310
.unwrap();
313311

314312
let output = affected_cmd()
315313
.args(["ci", "--base", "HEAD~1", "--root"])
316-
.arg(&root)
314+
.arg(dir.path())
317315
.output()
318316
.unwrap();
319317

@@ -359,18 +357,17 @@ fn test_cli_ci_no_changes() {
359357
#[test]
360358
fn test_cli_run_dry_run() {
361359
let dir = tempfile::tempdir().unwrap();
362-
let root = std::fs::canonicalize(dir.path()).unwrap();
363-
setup_cargo_workspace(&root);
360+
setup_cargo_workspace(dir.path());
364361

365362
// Make a change
366363
std::fs::write(
367-
root.join("crates/core/src/lib.rs"),
364+
dir.path().join("crates/core/src/lib.rs"),
368365
"pub fn hello() { /* run-test */ }\n",
369366
)
370367
.unwrap();
371368
std::process::Command::new("git")
372369
.args(["add", "-A"])
373-
.current_dir(&root)
370+
.current_dir(dir.path())
374371
.output()
375372
.unwrap();
376373
std::process::Command::new("git")
@@ -383,7 +380,7 @@ fn test_cli_run_dry_run() {
383380
"-m",
384381
"change core",
385382
])
386-
.current_dir(&root)
383+
.current_dir(dir.path())
387384
.output()
388385
.unwrap();
389386

@@ -396,7 +393,7 @@ fn test_cli_run_dry_run() {
396393
"--dry-run",
397394
"--root",
398395
])
399-
.arg(&root)
396+
.arg(dir.path())
400397
.assert()
401398
.success()
402399
.stdout(predicate::str::contains("[dry-run]"))

0 commit comments

Comments
 (0)