Skip to content

Commit

Permalink
fix: use regular println in internal test utils to avoid interferin…
Browse files Browse the repository at this point in the history
…g with `cargo test` runner (#9296)

* use regular println to avoid interfering with cargo test runner

* revert test change
  • Loading branch information
zerosnacks authored Nov 11, 2024
1 parent e028b92 commit b7fe62e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/script/src/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn format_receipt(chain: Chain, receipt: &AnyTransactionReceipt) -> String {
let gas_used = receipt.gas_used;
let gas_price = receipt.effective_gas_price;
format!(
"\n##### {chain}\n{status}Hash: {tx_hash:?}{caddr}\nBlock: {bn}\n{gas}\n\n",
"\n##### {chain}\n{status} Hash: {tx_hash:?}{caddr}\nBlock: {bn}\n{gas}\n\n",
status = if !receipt.inner.inner.inner.receipt.status.coerce_status() {
"❌ [Failed]"
} else {
Expand Down
7 changes: 4 additions & 3 deletions crates/test-utils/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ impl ExtTester {
/// This used to use a `static` `Lazy`, but this approach does not with `cargo-nextest` because it
/// runs each test in a separate process. Instead, we use a global lock file to ensure that only one
/// test can initialize the template at a time.
#[allow(clippy::disallowed_macros)]
pub fn initialize(target: &Path) {
let _ = sh_println!("initializing {}", target.display());
println!("initializing {}", target.display());

let tpath = TEMPLATE_PATH.as_path();
pretty_err(tpath, fs::create_dir_all(tpath));
Expand Down Expand Up @@ -253,7 +254,7 @@ pub fn initialize(target: &Path) {
if data != "1" {
// Initialize and build.
let (prj, mut cmd) = setup_forge("template", foundry_compilers::PathStyle::Dapptools);
let _ = sh_println!("- initializing template dir in {}", prj.root().display());
println!("- initializing template dir in {}", prj.root().display());

cmd.args(["init", "--force"]).assert_success();
// checkout forge-std
Expand Down Expand Up @@ -283,7 +284,7 @@ pub fn initialize(target: &Path) {
_read = Some(lock.read().unwrap());
}

let _ = sh_println!("- copying template dir from {}", tpath.display());
println!("- copying template dir from {}", tpath.display());
pretty_err(target, fs::create_dir_all(target));
pretty_err(target, copy_dir(tpath, target));
}
Expand Down

0 comments on commit b7fe62e

Please sign in to comment.