mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 17:15:11 +03:00
2151366b93
swc_ecma_ast: - Add `TargetEnv`. swc_ecma_loader: - Support specifying target environment.
24 lines
634 B
Rust
24 lines
634 B
Rust
use swc_common::FileName;
|
|
use swc_ecma_loader::resolvers::node::NodeModulesResolver;
|
|
use swc_ecma_transforms_module::path::{ImportResolver, NodeImportResolver};
|
|
use testing::run_test2;
|
|
type TestProvider = NodeImportResolver<NodeModulesResolver>;
|
|
|
|
#[test]
|
|
fn node_modules() {
|
|
let provider = TestProvider::default();
|
|
|
|
run_test2(false, |cm, _| {
|
|
let fm = cm.new_source_file(FileName::Real("foo".into()), "".into());
|
|
|
|
let resolved = provider
|
|
.resolve_import(&fm.name, "core-js")
|
|
.expect("should success");
|
|
|
|
assert_eq!(&*resolved, "core-js");
|
|
|
|
Ok(())
|
|
})
|
|
.unwrap();
|
|
}
|