cli: Propagate mocha exit status on error

This commit is contained in:
Armani Ferrante 2021-02-19 23:24:22 +08:00
parent 1ae8b52760
commit 79b791ffa8
No known key found for this signature in database
GPG Key ID: D597A80BCF8E12B7
2 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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()?;