summaryrefslogtreecommitdiff
path: root/cli/tests/integration/npm_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-10-21 11:20:18 -0400
committerGitHub <noreply@github.com>2022-10-21 15:20:18 +0000
commitbcfe279fba865763c87f9cd8d5a2d0b2cbf451be (patch)
tree68e4d1bc52e261df50279f9ecea14795d1c46f6c /cli/tests/integration/npm_tests.rs
parent0e1a71fec6fff5fe62d7e6b2bfffb7ab877d7b71 (diff)
feat(unstable/npm): initial type checking of npm specifiers (#16332)
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r--cli/tests/integration/npm_tests.rs49
1 files changed, 36 insertions, 13 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index bc19c613d..9fc817141 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -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()),
]
}