Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(napi): add noop feature in napi crate #1546

Merged
merged 1 commit into from Apr 10, 2023

Conversation

gaoquanzero
Copy link
Contributor

@gaoquanzero gaoquanzero commented Mar 28, 2023

@Brooooooklyn
Copy link
Sponsor Member

@gaoquanzero does this patch really fix the issue?

@gaoquanzero
Copy link
Contributor Author

@gaoquanzero does this patch really fix the issue?

hi, @Brooooooklyn
according to this comment #1032 (comment), this only happens at cargo test where napi build is not available.
the _napi_delete_reference symbol is called here https://github.com/napi-rs/napi-rs/blob/main/crates/napi/src/error.rs#L167, but feature noop not exist in napi crate(it's declared in napi-derive crate), so #[cfg(not(feature = "noop"))] makes no sense, this patch just made it work

minimal reproduce

#[cfg(test)]
mod tests {
  use napi::bindgen_prelude::*;
  fn test() -> Result<i32> {
    Ok(0)
  }

  #[test]
  fn test_it() {
    test();
  }
}
[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { path ="../napi-rs-main/crates/napi", version = "2.12.0", default-features = false, features = ["napi4", "noop"] }
napi-derive = "2.12.2"

@Brooooooklyn Brooooooklyn changed the title fix: add noop feature in napi crate chore(napi): add noop feature in napi crate Apr 10, 2023
@Brooooooklyn Brooooooklyn merged commit 7fdcd7a into napi-rs:main Apr 10, 2023
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to run cargo test since napi=2.10.0
2 participants