`, probably a quirk in swc_ecma_codegen
match &h.cache_calls[0].1 {
Emit::Cli((code, _)) => {
assert!(
code.contains("
Hello world!
"),
"jsx should have been preserved"
);
}
}
}
#[tokio::test]
async fn test_graph_import_map_remote_to_local() {
let fixtures = test_util::testdata_path().join("module_graph");
let maybe_import_map = Some(
ImportMap::from_json(
"file:///tests/importmap.json",
r#"{
"imports": {
"https://deno.land/x/b/mod.js": "./b/mod.js"
}
}
"#,
)
.expect("could not parse import map"),
);
let handler = Arc::new(Mutex::new(MockSpecifierHandler {
fixtures,
..Default::default()
}));
let mut builder = GraphBuilder::new(handler, maybe_import_map, None);
let specifier = resolve_url_or_path("file:///tests/importremap.ts")
.expect("could not resolve module");
builder.add(&specifier, false).await.expect("could not add");
builder.get_graph();
}
#[tokio::test]
async fn test_graph_with_lockfile() {
let fixtures = test_util::testdata_path().join("module_graph");
let lockfile_path = fixtures.join("lockfile.json");
let lockfile =
Lockfile::new(lockfile_path, false).expect("could not load lockfile");
let maybe_lockfile = Some(Arc::new(Mutex::new(lockfile)));
let handler = Arc::new(Mutex::new(MockSpecifierHandler {
fixtures,
..MockSpecifierHandler::default()
}));
let mut builder = GraphBuilder::new(handler.clone(), None, maybe_lockfile);
let specifier = resolve_url_or_path("file:///tests/main.ts")
.expect("could not resolve module");
builder
.add(&specifier, false)
.await
.expect("module not inserted");
builder.get_graph();
}
}