Browse Source

idl: Avoid interference from rust tests during IDL generation (#3058)

man0s 1 year ago
parent
commit
5f1f72c511
2 changed files with 5 additions and 2 deletions
  1. 2 1
      CHANGELOG.md
  2. 3 1
      idl/src/build.rs

+ 2 - 1
CHANGELOG.md

@@ -16,7 +16,8 @@ The minor version will be incremented upon a breaking change and the patch versi
 
 ### Fixes
 
-- idl: Make safety comment checks fail silently when program path env is not set ([#3045](https://github.com/coral-xyz/anchor/pull/3045])).
+- idl: Make safety comment checks fail silently when program path env is not set ([#3045](https://github.com/coral-xyz/anchor/pull/3045)).
+- idl: Avoid interference from rust tests during IDL generation ([#3058](https://github.com/coral-xyz/anchor/pull/3058)).
 
 ### Breaking
 

+ 3 - 1
idl/src/build.rs

@@ -130,7 +130,9 @@ fn build(program_path: &Path, resolution: bool, skip_lint: bool, no_docs: bool)
                 "--- IDL begin errors ---" => state = State::Errors(vec![]),
                 "--- IDL begin program ---" => state = State::Program(vec![]),
                 _ => {
-                    if line.starts_with("test result: ok") {
+                    if line.starts_with("test result: ok")
+                        && !line.starts_with("test result: ok. 0 passed; 0 failed; 0")
+                    {
                         if let Some(idl) = idl.as_mut() {
                             idl.address = mem::take(&mut address);
                             idl.constants = mem::take(&mut constants);