0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix(cli): info does not panic on missing modules (#8924)

Fixes #8918
This commit is contained in:
Kitson Kelly 2020-12-30 22:19:51 +11:00 committed by GitHub
parent 8011eced14
commit b1230a85e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 5 deletions

View file

@ -1107,11 +1107,13 @@ impl Graph {
totals: &mut HashMap<ModuleSpecifier, usize>,
) -> ModuleInfo {
let not_seen = seen.insert(specifier.clone());
let module = if let ModuleSlot::Module(module) = self.get_module(specifier)
{
module
} else {
unreachable!();
let module = match self.get_module(specifier) {
ModuleSlot::Module(module) => module,
ModuleSlot::Err(err) => {
error!("{}: {}", colors::red_bold("error"), err.to_string());
std::process::exit(1);
}
_ => unreachable!(),
};
let mut deps = Vec::new();
let mut total_size = None;

View file

@ -0,0 +1,2 @@
error: Cannot resolve module "file://[WILDCARD]/bad-module.js" from "file://[WILDCARD]/error_009_missing_js_module.js".
at file://[WILDCARD]/error_009_missing_js_module.js:1:0

View file

@ -3407,6 +3407,12 @@ itest!(import_file_with_colon {
http_server: true,
});
itest!(info_missing_module {
args: "info error_009_missing_js_module.js",
output: "info_missing_module.out",
exit_code: 1,
});
itest!(info_recursive_modules {
args: "info --quiet info_recursive_imports_test.ts",
output: "info_recursive_imports_test.out",