From 53f3fa27cdbcf8280ac70d0c35ecb98d8c89782a Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Tue, 27 Jan 2026 12:55:33 +0100 Subject: [PATCH] fix(tests): Use cargo_bin macro for binary discovery in tests Use the `cargo_bin!` macro from assert_cmd to locate the sentry-cli binary. This reads the `CARGO_BIN_EXE_sentry-cli` environment variable set by Cargo at compile time, making tests work regardless of custom `build-dir` settings in cargo config. Previously, both `Command::cargo_bin()` and trycmd's internal binary discovery would fail when a custom build directory was configured, causing tests to either error or silently pass as "ignored". Co-Authored-By: Claude --- tests/integration/test_utils/test_manager.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_utils/test_manager.rs b/tests/integration/test_utils/test_manager.rs index ba041108d2..9b99d09c8c 100644 --- a/tests/integration/test_utils/test_manager.rs +++ b/tests/integration/test_utils/test_manager.rs @@ -1,6 +1,7 @@ use std::ffi::OsStr; use std::fmt::Display; +use assert_cmd::cargo::cargo_bin; use assert_cmd::Command; use mockito::{Mock, Server, ServerGuard}; use thiserror::Error; @@ -163,6 +164,7 @@ impl TrycmdTestManager { fn new(manager: TestManager, path: impl Display) -> Self { let test_case = TestCases::new(); + test_case.register_bin("sentry-cli", cargo_bin!("sentry-cli")); env::set(manager.server_info(), |k, v| { test_case.env(k, v); @@ -228,7 +230,7 @@ impl AssertCmdTestManager { I: IntoIterator, S: AsRef, { - let mut command = Command::cargo_bin("sentry-cli").expect("sentry-cli should be available"); + let mut command = Command::new(cargo_bin!("sentry-cli")); command.args(args); env::set(manager.server_info(), |k, v| {