diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 7632c492545..b566131f423 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -150,6 +150,9 @@ css_utils = ["__css", "swc_css_utils"] css_visit = ["__css", "swc_css_visit"] css_visit_path = ["__css", "swc_css_visit/path"] +# Utilities for testing. +testing = ["dep:testing"] + # Enable trace macro support. # TODO: Once all top-level package (node, wasm, cli..) imports swc_core, # we may encapsulate `tracing` package into swc_core. @@ -333,11 +336,9 @@ swc_plugin = { optional = true, version = "0.90.0", path = swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" } swc_plugin_proxy = { optional = true, version = "0.19.3", path = "../swc_plugin_proxy" } swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" } +testing = { optional = true, version = "0.30.2", path = "../testing" } # TODO: eventually swc_plugin_runner needs to remove default features swc_plugin_runner = { optional = true, version = "0.74.6", path = "../swc_plugin_runner", default-features = false } -[dev-dependencies] -testing = { version = "0.30.2", path = "../testing" } - [build-dependencies] vergen = { version = "7.3.2", default-features = false, features = ["cargo"] } diff --git a/crates/swc_core/src/lib.rs b/crates/swc_core/src/lib.rs index 2321c7b8eb1..1658214b772 100644 --- a/crates/swc_core/src/lib.rs +++ b/crates/swc_core/src/lib.rs @@ -215,6 +215,15 @@ pub mod cached { pub use swc_cached::*; } +// This reexports generic testing utilities only. +// For the feature-specific (i.e ecma_transform_testing), need to enable +// Corresponding features instead. +#[cfg(feature = "testing")] +#[cfg_attr(docsrs, doc(cfg(feature = "testing")))] +pub mod testing { + pub use swc_testing::*; +} + #[cfg(feature = "allocator_node")] #[cfg_attr(docsrs, doc(cfg(feature = "allocator_node")))] extern crate swc_node_base;