Skip to content

Commit 5895757

Browse files
committed
use get_test_process_cmd() to get base command
1 parent 7884371 commit 5895757

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

crates/cli_bin/tests/common/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::{env, path};
1+
use std::{env, path, process};
22

33
use anyhow::Result;
4+
use assert_cmd::cargo::CommandCargoExt;
45
use assert_cmd::Command;
56

67
use marzano_gritmodule::config::GRIT_GLOBAL_DIR_ENV;
@@ -15,6 +16,13 @@ pub fn get_test_cmd() -> Result<Command> {
1516
Ok(cmd)
1617
}
1718

19+
#[allow(dead_code)]
20+
pub fn get_test_process_cmd() -> Result<process::Command> {
21+
let mut cmd = process::Command::cargo_bin(BIN_NAME)?;
22+
cmd.env("GRIT_TELEMETRY_DISABLED", "true");
23+
Ok(cmd)
24+
}
25+
1826
// This is used in tests
1927
#[allow(dead_code)]
2028
pub fn get_fixtures_root() -> Result<std::path::PathBuf> {

crates/cli_bin/tests/patterns_test.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
use std::{
22
env, fs,
33
io::{BufRead, BufReader},
4-
process::{Command, Stdio},
4+
process::Stdio,
55
sync::mpsc,
66
thread,
77
time::Duration,
88
};
99

1010
use anyhow::Result;
11-
use assert_cmd::cargo::CommandCargoExt;
1211
use insta::assert_snapshot;
1312

14-
use crate::common::{get_fixture, get_test_cmd, BIN_NAME};
13+
use crate::common::{get_fixture, get_test_cmd, get_test_process_cmd};
1514

1615
mod common;
1716

@@ -329,7 +328,7 @@ fn patterns_test_watch_mode_case_patterns_changed() -> Result<()> {
329328
let temp_dir_path = temp_dir.path().to_owned();
330329

331330
let _cmd_handle = thread::spawn(move || {
332-
let mut cmd = Command::cargo_bin(BIN_NAME)
331+
let mut cmd = get_test_process_cmd()
333332
.unwrap()
334333
.args(&["patterns", "test", "--watch"])
335334
.current_dir(&temp_dir_path)
@@ -381,7 +380,7 @@ fn patterns_test_watch_mode_case_no_pattern_to_test() -> Result<()> {
381380
let temp_dir_path = temp_dir.path().to_owned();
382381

383382
let _cmd_handle = thread::spawn(move || {
384-
let mut cmd = Command::cargo_bin(BIN_NAME)
383+
let mut cmd = get_test_process_cmd()
385384
.unwrap()
386385
.args(&["patterns", "test", "--watch"])
387386
.current_dir(&temp_dir_path)

0 commit comments

Comments
 (0)