diff --git a/crates/backend/src/codegen/const.rs b/crates/backend/src/codegen/const.rs index b520603f..5fd14a00 100644 --- a/crates/backend/src/codegen/const.rs +++ b/crates/backend/src/codegen/const.rs @@ -38,6 +38,7 @@ impl NapiConst { } #[allow(non_snake_case)] #[allow(clippy::all)] + #[cfg(not(test))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #cb_name); diff --git a/crates/backend/src/codegen/enum.rs b/crates/backend/src/codegen/enum.rs index 3d950436..11060823 100644 --- a/crates/backend/src/codegen/enum.rs +++ b/crates/backend/src/codegen/enum.rs @@ -147,6 +147,7 @@ impl NapiEnum { } #[allow(non_snake_case)] #[allow(clippy::all)] + #[cfg(not(test))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #callback_name); diff --git a/crates/backend/src/codegen/fn.rs b/crates/backend/src/codegen/fn.rs index 426a29a8..7ca411fc 100644 --- a/crates/backend/src/codegen/fn.rs +++ b/crates/backend/src/codegen/fn.rs @@ -327,6 +327,7 @@ impl NapiFn { #[allow(clippy::all)] #[allow(non_snake_case)] + #[cfg(not(test))] #[napi::bindgen_prelude::ctor] fn #module_register_name() { napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name, #cb_name); diff --git a/crates/backend/src/codegen/struct.rs b/crates/backend/src/codegen/struct.rs index 655d6ab5..e09af144 100644 --- a/crates/backend/src/codegen/struct.rs +++ b/crates/backend/src/codegen/struct.rs @@ -437,6 +437,7 @@ impl NapiStruct { quote! { #[allow(non_snake_case)] #[allow(clippy::all)] + #[cfg(not(test))] #[napi::bindgen_prelude::ctor] fn #struct_register_name() { napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]); @@ -506,6 +507,7 @@ impl NapiImpl { use super::*; #(#methods)* + #[cfg(not(test))] #[napi::bindgen_prelude::ctor] fn #register_name() { napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]);