fix(napi-derive): disable register logic in rust test

This commit is contained in:
LongYinan 2021-12-06 12:58:58 +08:00
parent 8d6997f61e
commit 27c4790e7b
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
4 changed files with 5 additions and 0 deletions

View file

@ -38,6 +38,7 @@ impl NapiConst {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(clippy::all)] #[allow(clippy::all)]
#[cfg(not(test))]
#[napi::bindgen_prelude::ctor] #[napi::bindgen_prelude::ctor]
fn #register_name() { fn #register_name() {
napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #cb_name); napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #cb_name);

View file

@ -147,6 +147,7 @@ impl NapiEnum {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(clippy::all)] #[allow(clippy::all)]
#[cfg(not(test))]
#[napi::bindgen_prelude::ctor] #[napi::bindgen_prelude::ctor]
fn #register_name() { fn #register_name() {
napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #callback_name); napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name_lit, #callback_name);

View file

@ -327,6 +327,7 @@ impl NapiFn {
#[allow(clippy::all)] #[allow(clippy::all)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[cfg(not(test))]
#[napi::bindgen_prelude::ctor] #[napi::bindgen_prelude::ctor]
fn #module_register_name() { fn #module_register_name() {
napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name, #cb_name); napi::bindgen_prelude::register_module_export(#js_mod_ident, #js_name, #cb_name);

View file

@ -437,6 +437,7 @@ impl NapiStruct {
quote! { quote! {
#[allow(non_snake_case)] #[allow(non_snake_case)]
#[allow(clippy::all)] #[allow(clippy::all)]
#[cfg(not(test))]
#[napi::bindgen_prelude::ctor] #[napi::bindgen_prelude::ctor]
fn #struct_register_name() { fn #struct_register_name() {
napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]); napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]);
@ -506,6 +507,7 @@ impl NapiImpl {
use super::*; use super::*;
#(#methods)* #(#methods)*
#[cfg(not(test))]
#[napi::bindgen_prelude::ctor] #[napi::bindgen_prelude::ctor]
fn #register_name() { fn #register_name() {
napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]); napi::bindgen_prelude::register_class(#name_str, #js_mod_ident, #js_name, vec![#(#props),*]);