diff --git a/packages/yew/src/html/component/scope.rs b/packages/yew/src/html/component/scope.rs
index 9253228fa2e..952978e944f 100644
--- a/packages/yew/src/html/component/scope.rs
+++ b/packages/yew/src/html/component/scope.rs
@@ -513,7 +513,7 @@ mod feat_csr {
use crate::scheduler;
impl AnyScope {
- #[cfg(test)]
+ #[cfg(any(test, feature = "test"))]
pub(crate) fn test() -> Self {
Self {
type_id: TypeId::of::<()>(),
diff --git a/packages/yew/src/lib.rs b/packages/yew/src/lib.rs
index 63d6a82c00b..44918b4f108 100644
--- a/packages/yew/src/lib.rs
+++ b/packages/yew/src/lib.rs
@@ -293,7 +293,7 @@ mod app_handle;
#[cfg(feature = "csr")]
mod renderer;
-#[cfg(all(feature = "csr", any(test, feature="test")))]
+#[cfg(all(feature = "csr", any(test, feature = "test")))]
#[allow(missing_docs)]
pub mod tests;