Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make --gas-report JSON output compatible #9063

Merged
merged 11 commits into from
Oct 10, 2024
Prev Previous commit
Next Next commit
merge in master
  • Loading branch information
zerosnacks committed Oct 9, 2024
commit c3e8bc1ba41a6ca7b2f986d205e1c7bf7cb2e8b6
14 changes: 13 additions & 1 deletion crates/forge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
@@ -502,8 +502,20 @@ impl TestArgs {
runner.decode_internal = InternalTraceMode::Full;
}

// Run tests in a non-streaming fashion and collect results for serialization.
if !self.gas_report && self.json {
let results = runner.test_collect(filter);
let mut results = runner.test_collect(filter);
results.values_mut().for_each(|suite_result| {
for test_result in suite_result.test_results.values_mut() {
if verbosity >= 2 {
// Decode logs at level 2 and above.
test_result.decoded_logs = decode_console_logs(&test_result.logs);
} else {
// Empty logs for non verbose runs.
test_result.logs = vec![];
}
}
});
println!("{}", serde_json::to_string(&results)?);
return Ok(TestOutcome::new(results, self.allow_failure));
}
You are viewing a condensed version of this merge commit. You can view the full changes here.