Skip to content

Commit f475a11

Browse files
committed
chore(core): remove setup function and redundant environment variable clearing
1 parent 726f5a0 commit f475a11

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

packages/nx/src/native/tui/nx_console.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,9 @@ fn get_env_var<'a>(name: &str, env_map: &'a mut HashMap<String, String>) -> Opti
7474
mod tests {
7575
use super::*;
7676
use std::collections::HashMap;
77-
use std::env;
78-
79-
fn setup() {
80-
// Clear relevant environment variables before each test
81-
env::remove_var("TERM_PROGRAM");
82-
env::remove_var("VSCODE_GIT_ASKPASS_NODE");
83-
}
8477

8578
#[test]
8679
fn test_detect_vscode() {
87-
setup();
8880
let mut test_env = HashMap::new();
8981
test_env.insert("TERM_PROGRAM".to_string(), "vscode".to_string());
9082
test_env.insert(
@@ -96,7 +88,6 @@ mod tests {
9688

9789
#[test]
9890
fn test_detect_cursor() {
99-
setup();
10091
let mut test_env = HashMap::new();
10192
test_env.insert("TERM_PROGRAM".to_string(), "vscode".to_string());
10293
test_env.insert(
@@ -108,7 +99,6 @@ mod tests {
10899

109100
#[test]
110101
fn test_detect_windsurf() {
111-
setup();
112102
let mut test_env = HashMap::new();
113103
test_env.insert("TERM_PROGRAM".to_string(), "vscode".to_string());
114104
test_env.insert(
@@ -120,21 +110,13 @@ mod tests {
120110

121111
#[test]
122112
fn test_detect_jetbrains() {
123-
setup();
124113
let mut test_env = HashMap::new();
125114
test_env.insert("TERM_PROGRAM".to_string(), "jetbrains".to_string());
126115
assert_eq!(detect_editor(test_env), SupportedEditor::JetBrains);
127116
}
128117

129-
#[test]
130-
fn test_term_program_missing() {
131-
setup();
132-
assert_eq!(detect_editor(HashMap::new()), SupportedEditor::Unknown);
133-
}
134-
135118
#[test]
136119
fn test_term_program_unknown() {
137-
setup();
138120
let mut test_env = HashMap::new();
139121
test_env.insert(
140122
"TERM_PROGRAM".to_string(),
@@ -145,7 +127,6 @@ mod tests {
145127

146128
#[test]
147129
fn test_vscode_without_askpass_confirmation() {
148-
setup();
149130
let mut test_env = HashMap::new();
150131
test_env.insert("TERM_PROGRAM".to_string(), "vscode".to_string());
151132
// No VSCODE_GIT_ASKPASS_NODE set or doesn't contain "vscode"
@@ -154,7 +135,6 @@ mod tests {
154135

155136
#[test]
156137
fn test_vscode_with_wrong_askpass() {
157-
setup();
158138
let mut test_env = HashMap::new();
159139
test_env.insert("TERM_PROGRAM".to_string(), "vscode".to_string());
160140
test_env.insert(
@@ -166,7 +146,6 @@ mod tests {
166146

167147
#[test]
168148
fn test_case_insensitivity() {
169-
setup();
170149
let mut test_env = HashMap::new();
171150
test_env.insert("TERM_PROGRAM".to_string(), "VSCode".to_string());
172151
test_env.insert(
@@ -178,7 +157,6 @@ mod tests {
178157

179158
#[test]
180159
fn test_cursor_without_askpass_confirmation() {
181-
setup();
182160
let mut test_env = HashMap::new();
183161
test_env.insert("TERM_PROGRAM".to_string(), "cursor".to_string());
184162
// No VSCODE_GIT_ASKPASS_NODE set
@@ -187,7 +165,6 @@ mod tests {
187165

188166
#[test]
189167
fn test_cursor_with_wrong_askpass() {
190-
setup();
191168
let mut test_env = HashMap::new();
192169
test_env.insert("TERM_PROGRAM".to_string(), "cursor".to_string());
193170
test_env.insert(
@@ -199,7 +176,6 @@ mod tests {
199176

200177
#[test]
201178
fn test_windsurf_without_askpass_confirmation() {
202-
setup();
203179
let mut test_env = HashMap::new();
204180
test_env.insert("TERM_PROGRAM".to_string(), "windsurf".to_string());
205181
// No VSCODE_GIT_ASKPASS_NODE set
@@ -208,7 +184,6 @@ mod tests {
208184

209185
#[test]
210186
fn test_windsurf_with_wrong_askpass() {
211-
setup();
212187
let mut test_env = HashMap::new();
213188
test_env.insert("TERM_PROGRAM".to_string(), "windsurf".to_string());
214189
test_env.insert(

0 commit comments

Comments
 (0)