Skip to content

Commit 93e68de

Browse files
codexByron
andcommitted
isolate editor env in reword CLI tests
Clear inherited GIT_EDITOR, VISUAL, and EDITOR in the shared test harness so CLI tests don't pick up the developer's shell settings. Othewise the test may fail as it tries to open the user editor under GIT_EDITOR which takes precedence. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
1 parent 0556cac commit 93e68de

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

crates/but-testsupport/src/prepare_cmd_env.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ fn updates() -> Vec<EnvOp> {
5454
EnvOp::Remove("GIT_COMMON_DIR"),
5555
EnvOp::Remove("GIT_ASKPASS"),
5656
EnvOp::Remove("SSH_ASKPASS"),
57+
EnvOp::Remove("GIT_EDITOR"),
58+
EnvOp::Remove("VISUAL"),
59+
EnvOp::Remove("EDITOR"),
5760
]
5861
.into_iter()
5962
.chain(

crates/but/tests/but/command/reword.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn reword_branch_from_editor_trims_trailing_newlines_in_confirmation_output() ->
8989
"#!/usr/bin/env bash\nprintf 'renamed-branch\\n\\n' > \"$1\"\n",
9090
);
9191
env.but("reword branch-to-rename-123")
92-
.env("EDITOR", "bash editor.sh")
92+
.env("GIT_EDITOR", "bash editor.sh")
9393
.assert()
9494
.success()
9595
.stdout_eq(str![[r#"

0 commit comments

Comments
 (0)