mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
feat(unstable/npm): initial type checking of npm specifiers (#16332)
This commit is contained in:
parent
0e1a71fec6
commit
bcfe279fba
64 changed files with 2135 additions and 280 deletions
|
@ -1,6 +1,5 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use deno_core::url::Url;
|
||||
use std::process::Stdio;
|
||||
use test_util as util;
|
||||
use util::assert_contains;
|
||||
|
@ -34,7 +33,7 @@ itest!(esm_module_deno_test {
|
|||
});
|
||||
|
||||
itest!(esm_import_cjs_default {
|
||||
args: "run --allow-read --allow-env --unstable --quiet npm/esm_import_cjs_default/main.js",
|
||||
args: "run --allow-read --allow-env --unstable --quiet --check=all npm/esm_import_cjs_default/main.ts",
|
||||
output: "npm/esm_import_cjs_default/main.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
|
@ -84,7 +83,7 @@ itest!(translate_cjs_to_esm {
|
|||
});
|
||||
|
||||
itest!(compare_globals {
|
||||
args: "run --allow-read --unstable npm/compare_globals/main.js",
|
||||
args: "run --allow-read --unstable --check=all npm/compare_globals/main.ts",
|
||||
output: "npm/compare_globals/main.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
|
@ -210,6 +209,38 @@ itest!(deno_cache {
|
|||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(check_all {
|
||||
args: "check --unstable --remote npm/check_errors/main.ts",
|
||||
output: "npm/check_errors/main_all.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(check_local {
|
||||
args: "check --unstable npm/check_errors/main.ts",
|
||||
output: "npm/check_errors/main_local.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(types_ambient_module {
|
||||
args: "check --unstable --quiet npm/types_ambient_module/main.ts",
|
||||
output: "npm/types_ambient_module/main.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(types_ambient_module_import_map {
|
||||
args: "check --unstable --quiet --import-map=npm/types_ambient_module/import_map.json npm/types_ambient_module/main_import_map.ts",
|
||||
output: "npm/types_ambient_module/main_import_map.out",
|
||||
envs: env_vars(),
|
||||
http_server: true,
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
#[test]
|
||||
fn parallel_downloading() {
|
||||
let (out, _err) = util::run_and_collect_output_with_args(
|
||||
|
@ -672,18 +703,10 @@ fn ensure_registry_files_local() {
|
|||
}
|
||||
}
|
||||
|
||||
fn std_file_url() -> String {
|
||||
let u = Url::from_directory_path(util::std_path()).unwrap();
|
||||
u.to_string()
|
||||
}
|
||||
|
||||
fn env_vars_no_sync_download() -> Vec<(String, String)> {
|
||||
vec![
|
||||
("DENO_NODE_COMPAT_URL".to_string(), std_file_url()),
|
||||
(
|
||||
"DENO_NPM_REGISTRY".to_string(),
|
||||
"http://localhost:4545/npm/registry/".to_string(),
|
||||
),
|
||||
("DENO_NODE_COMPAT_URL".to_string(), util::std_file_url()),
|
||||
("DENO_NPM_REGISTRY".to_string(), util::npm_registry_url()),
|
||||
("NO_COLOR".to_string(), "1".to_string()),
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue