Skip to content

Commit 79b791f

Browse files
cli: Propagate mocha exit status on error
1 parent 1ae8b52 commit 79b791f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ incremented for features.
1515

1616
* ts: Allow preloading instructions for state rpc transactions ([cf9c84](https://github.com/project-serum/anchor/commit/cf9c847e4144989b5bc1936149d171e90204777b)).
1717

18+
## Fixes
19+
20+
* cli: Propagates mocha test exit status on error.
21+
1822
## [0.2.1] - 2021-02-11
1923

2024
### Features

cli/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,19 +606,20 @@ fn test(skip_deploy: bool) -> Result<()> {
606606
let log_streams = stream_logs(&cfg.cluster.url())?;
607607

608608
// Run the tests.
609-
if let Err(e) = std::process::Command::new("mocha")
609+
let exit = std::process::Command::new("mocha")
610610
.arg("-t")
611611
.arg("1000000")
612612
.arg("tests/")
613613
.env("ANCHOR_PROVIDER_URL", cfg.cluster.url())
614614
.stdout(Stdio::inherit())
615615
.stderr(Stdio::inherit())
616-
.output()
617-
{
616+
.output()?;
617+
618+
if !exit.status.success() {
618619
if let Some(mut validator_handle) = validator_handle {
619620
validator_handle.kill()?;
620621
}
621-
return Err(anyhow::format_err!("{}", e.to_string()));
622+
std::process::exit(exit.status.code().unwrap());
622623
}
623624
if let Some(mut validator_handle) = validator_handle {
624625
validator_handle.kill()?;

0 commit comments

Comments
 (0)