Skip to content

Commit

Permalink
Fix Anchor implementation of RunHigh::build_source_file
Browse files Browse the repository at this point in the history
The Anchor backend was calling `anchor build`, which compiles only
Rust source files, not TypeScript source files. The fix is to call
`Anchor::check` like the backend's implementation of `dry_run` does.
  • Loading branch information
smoelius committed Oct 18, 2024
1 parent 399ab12 commit cf36b40
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions backends/src/anchor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,8 @@ impl RunHigh for Anchor {
self.mocha_adapter.0.statement_prefix_and_suffix(span)
}

fn build_source_file(&self, context: &LightContext, _source_file: &Path) -> Result<()> {
let mut command = command_to_build_source_file(context);

debug!("{:?}", command);

let output = command.output_stripped_of_ansi_escapes()?;
if !output.status().success() {
return Err(output.into());
}
Ok(())
fn build_source_file(&self, context: &LightContext, source_file: &Path) -> Result<()> {
self.check(context, source_file)
}

fn exec(
Expand Down Expand Up @@ -212,15 +204,6 @@ fn parse_test_value(test_value: &mut Value) -> Result<(String, String)> {
Ok((captures[1].to_string(), captures[2].to_string()))
}

fn command_to_build_source_file(context: &LightContext) -> Command {
let mut command = Command::new("anchor");
command.arg("build");
command.args(&context.opts.args);
command.current_dir(context.root.as_path());

command
}

fn command_to_run_test(context: &LightContext) -> Command {
let mut command = Command::new("anchor");
command.arg("test");
Expand Down

0 comments on commit cf36b40

Please # to comment.