From c1fa8fbeba7bb9a35d144af3ae9d483c2baf4c76 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 10 Nov 2020 10:10:41 +1100 Subject: fix(cli): allow root modules be .mjs/.cjs (#8310) Fixes #6176 --- cli/module_graph.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cli/module_graph.rs') diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 493bc2dc4..bf3972904 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -2007,6 +2007,27 @@ pub mod tests { assert_eq!(h.tsbuildinfo_calls.len(), 1); } + #[tokio::test] + async fn fix_graph_check_mjs_root() { + let specifier = ModuleSpecifier::resolve_url_or_path("file:///tests/a.mjs") + .expect("could not resolve module"); + let (graph, handler) = setup(specifier).await; + let result_info = graph + .check(CheckOptions { + debug: false, + emit: true, + lib: TypeLib::DenoWindow, + maybe_config_path: None, + reload: false, + }) + .expect("should have checked"); + assert!(result_info.maybe_ignored_options.is_none()); + assert!(result_info.diagnostics.is_empty()); + let h = handler.borrow(); + assert_eq!(h.cache_calls.len(), 1); + assert_eq!(h.tsbuildinfo_calls.len(), 1); + } + #[tokio::test] async fn fix_graph_check_types_root() { let specifier = ModuleSpecifier::resolve_url_or_path("file:///typesref.js") -- cgit v1.2.3