Skip to content

Commit

Permalink
cli: Propagate mocha exit status on error
Browse files Browse the repository at this point in the history
  • Loading branch information
armaniferrante committed Feb 19, 2021
1 parent 1ae8b52 commit 79b791f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ incremented for features.

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

## Fixes

* cli: Propagates mocha test exit status on error.

## [0.2.1] - 2021-02-11

### Features
Expand Down
9 changes: 5 additions & 4 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,19 +606,20 @@ fn test(skip_deploy: bool) -> Result<()> {
let log_streams = stream_logs(&cfg.cluster.url())?;

// Run the tests.
if let Err(e) = std::process::Command::new("mocha")
let exit = std::process::Command::new("mocha")
.arg("-t")
.arg("1000000")
.arg("tests/")
.env("ANCHOR_PROVIDER_URL", cfg.cluster.url())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
{
.output()?;

if !exit.status.success() {
if let Some(mut validator_handle) = validator_handle {
validator_handle.kill()?;
}
return Err(anyhow::format_err!("{}", e.to_string()));
std::process::exit(exit.status.code().unwrap());
}
if let Some(mut validator_handle) = validator_handle {
validator_handle.kill()?;
Expand Down

0 comments on commit 79b791f

Please sign in to comment.