feat(swc_core): Export testing utilities (#5839)

**Description:**

This PR exports general testing utilities from swc_core.
This commit is contained in:
OJ Kwon 2022-09-12 15:31:26 -07:00 committed by GitHub
parent 2df19176fb
commit 856d741ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -150,6 +150,9 @@ css_utils = ["__css", "swc_css_utils"]
css_visit = ["__css", "swc_css_visit"] css_visit = ["__css", "swc_css_visit"]
css_visit_path = ["__css", "swc_css_visit/path"] css_visit_path = ["__css", "swc_css_visit/path"]
# Utilities for testing.
testing = ["dep:testing"]
# Enable trace macro support. # Enable trace macro support.
# TODO: Once all top-level package (node, wasm, cli..) imports swc_core, # TODO: Once all top-level package (node, wasm, cli..) imports swc_core,
# we may encapsulate `tracing` package into 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_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_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" } 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 # 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 } 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] [build-dependencies]
vergen = { version = "7.3.2", default-features = false, features = ["cargo"] } vergen = { version = "7.3.2", default-features = false, features = ["cargo"] }

View File

@ -215,6 +215,15 @@ pub mod cached {
pub use swc_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(feature = "allocator_node")]
#[cfg_attr(docsrs, doc(cfg(feature = "allocator_node")))] #[cfg_attr(docsrs, doc(cfg(feature = "allocator_node")))]
extern crate swc_node_base; extern crate swc_node_base;