Skip to content

Commit

Permalink
Disable --test flag with sui client publish
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbmb committed Sep 14, 2023
1 parent fb83754 commit 391b811
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/sui/src/client_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,19 @@ impl SuiClientCommands {
serialize_signed_transaction,
lint,
} => {
if build_config.test_mode {
return Err(SuiError::ModulePublishFailure {
error: format!(
"The `publish` subcommand should not be used with the `--test` flag\n\
\n\
Library code in published packages must not depend on test code.\n\
In order to fix this and publish the package without `--test`, search for, and remove \
instances of e.g. test modules declared as `friend`s of modules from `sources/`."
),
}
.into());
}

let sender = context.try_get_object_owner(&gas).await?;
let sender = sender.unwrap_or(context.active_address()?);

Expand Down

0 comments on commit 391b811

Please sign in to comment.