summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/integration/info_tests.rs124
-rw-r--r--tests/integration/mod.rs2
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts11
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out9
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/__test__.jsonc5
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/mod1.ts17
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/mod2.ts1
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/print_hello.ts3
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts4
-rw-r--r--tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts9
-rw-r--r--tests/specs/info_tests/data_null_error/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out (renamed from tests/testdata/info/data_null_error/data_null_error.out)0
-rw-r--r--tests/specs/info_tests/data_null_error/data_null_error/mod.ts (renamed from tests/testdata/info/data_null_error/mod.ts)0
-rw-r--r--tests/specs/info_tests/data_null_error/data_null_error/types.d.ts (renamed from tests/testdata/info/data_null_error/types.d.ts)0
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc5
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out10
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js14
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json3
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json3
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js1
-rw-r--r--tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts1
-rw-r--r--tests/specs/info_tests/info_flag/041_info_flag.out (renamed from tests/testdata/info/041_info_flag.out)0
-rw-r--r--tests/specs/info_tests/info_flag/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_flag_location/041_info_flag_location.out (renamed from tests/testdata/info/041_info_flag_location.out)0
-rw-r--r--tests/specs/info_tests/info_flag_location/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out (renamed from tests/testdata/info/049_info_flag_script_jsx.out)0
-rw-r--r--tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_import_map/__test__.jsonc5
-rw-r--r--tests/specs/info_tests/info_import_map/deno.json (renamed from tests/testdata/info/with_import_map/deno.json)0
-rw-r--r--tests/specs/info_tests/info_import_map/deno.lock (renamed from tests/testdata/info/with_import_map/deno.lock)0
-rw-r--r--tests/specs/info_tests/info_import_map/main.tsx (renamed from tests/testdata/info/with_import_map/main.tsx)0
-rw-r--r--tests/specs/info_tests/info_import_map/with_import_map.out (renamed from tests/testdata/info/with_import_map/with_import_map.out)0
-rw-r--r--tests/specs/info_tests/info_json/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_json/info_json.out (renamed from tests/testdata/info/info_json.out)0
-rw-r--r--tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out (renamed from tests/testdata/info/076_info_json_deps_order.out)0
-rw-r--r--tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts (renamed from tests/testdata/info/076_info_json_deps_order.ts)0
-rw-r--r--tests/specs/info_tests/info_json_deps_order/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts7
-rw-r--r--tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts7
-rw-r--r--tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts8
-rw-r--r--tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts2
-rw-r--r--tests/specs/info_tests/info_json_location/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_json_location/info_json_location.out (renamed from tests/testdata/info/info_json_location.out)0
-rw-r--r--tests/specs/info_tests/info_missing_module/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js1
-rw-r--r--tests/specs/info_tests/info_missing_module/info_missing_module.out (renamed from tests/testdata/info/info_missing_module.out)0
-rw-r--r--tests/specs/info_tests/info_recursive_modules/__test__.jsonc5
-rw-r--r--tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out (renamed from tests/testdata/info/info_recursive_imports_test.out)0
-rw-r--r--tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts5
-rw-r--r--tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts7
-rw-r--r--tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts7
-rw-r--r--tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts8
-rw-r--r--tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts2
-rw-r--r--tests/specs/info_tests/info_type_import/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/info_type_import/info_type_import.out (renamed from tests/testdata/info/info_type_import.out)0
-rw-r--r--tests/specs/info_tests/info_type_import/info_type_import.ts3
-rw-r--r--tests/specs/info_tests/info_type_import/type_and_code.ts7
-rw-r--r--tests/specs/info_tests/json_file/__test__.jsonc5
-rw-r--r--tests/specs/info_tests/json_file/json_output/main.out (renamed from tests/testdata/info/json_output/main.out)18
-rw-r--r--tests/specs/info_tests/json_file/json_output/main.ts (renamed from tests/testdata/info/json_output/main.ts)2
-rw-r--r--tests/specs/info_tests/json_file/mod1.ts17
-rw-r--r--tests/specs/info_tests/json_file/mod2.ts1
-rw-r--r--tests/specs/info_tests/json_file/print_hello.ts3
-rw-r--r--tests/specs/info_tests/json_file/subdir2/dynamic_import.ts4
-rw-r--r--tests/specs/info_tests/json_file/subdir2/mod2.ts9
-rw-r--r--tests/specs/info_tests/multiple_imports/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/multiple_imports/multiple_imports.out (renamed from tests/testdata/info/multiple_imports.out)0
-rw-r--r--tests/specs/info_tests/types_header_direct/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/types_header_direct/type_directives_01.ts3
-rw-r--r--tests/specs/info_tests/types_header_direct/types_header.out (renamed from tests/testdata/info/types_header.out)0
-rw-r--r--tests/specs/info_tests/with_config_override/__test__.jsonc4
-rw-r--r--tests/specs/info_tests/with_config_override/with_config/deno-override.json (renamed from tests/testdata/info/with_config/deno-override.json)0
-rw-r--r--tests/specs/info_tests/with_config_override/with_config/deno.json (renamed from tests/testdata/info/with_config/deno.json)0
-rw-r--r--tests/specs/info_tests/with_config_override/with_config/import_map.json (renamed from tests/testdata/info/with_config/import_map.json)0
-rw-r--r--tests/specs/info_tests/with_config_override/with_config/test.ts (renamed from tests/testdata/info/with_config/test.ts)0
-rw-r--r--tests/specs/info_tests/with_config_override/with_config/with_config.out (renamed from tests/testdata/info/with_config/with_config.out)0
-rw-r--r--tests/testdata/info/054_info_local_imports.out9
-rwxr-xr-xtools/lint.js1
78 files changed, 270 insertions, 146 deletions
diff --git a/tests/integration/info_tests.rs b/tests/integration/info_tests.rs
deleted file mode 100644
index 7699baba8..000000000
--- a/tests/integration/info_tests.rs
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
-
-use test_util as util;
-use test_util::itest;
-use util::TestContextBuilder;
-
-#[test]
-fn info_lock_write() {
- let context = TestContextBuilder::new().use_http_server().build();
-
- context.temp_dir().write("deno.json", "{}");
-
- let module_path = "http://127.0.0.1:4545/run/048_media_types_jsx.ts";
-
- let output = context
- .new_command()
- .current_dir(context.temp_dir().path())
- .args_vec(["info", module_path])
- .run();
- output.assert_exit_code(0);
- output.skip_output_check();
-
- assert!(
- context.temp_dir().path().join("deno.lock").exists(),
- "missing deno.lock"
- );
-}
-
-itest!(multiple_imports {
- args: "info http://127.0.0.1:4545/run/019_media_types.ts",
- output: "info/multiple_imports.out",
- http_server: true,
-});
-
-itest!(info_flag {
- args: "info",
- output: "info/041_info_flag.out",
-});
-
-itest!(info_flag_location {
- args: "info --location https://deno.land",
- output: "info/041_info_flag_location.out",
-});
-
-itest!(info_json {
- args: "info --json",
- output: "info/info_json.out",
-});
-
-itest!(info_json_location {
- args: "info --json --location https://deno.land",
- output: "info/info_json_location.out",
-});
-
-itest!(info_flag_script_jsx {
- args: "info http://127.0.0.1:4545/run/048_media_types_jsx.ts",
- output: "info/049_info_flag_script_jsx.out",
- http_server: true,
-});
-
-itest!(json_file {
- args: "info --quiet --json info/json_output/main.ts",
- output: "info/json_output/main.out",
- exit_code: 0,
-});
-
-itest!(info_json_deps_order {
- args: "info --json info/076_info_json_deps_order.ts",
- output: "info/076_info_json_deps_order.out",
-});
-
-itest!(info_missing_module {
- args: "info info/error_009_missing_js_module.js",
- output: "info/info_missing_module.out",
-});
-
-itest!(info_recursive_modules {
- args: "info --quiet info/info_recursive_imports_test.ts",
- output: "info/info_recursive_imports_test.out",
- exit_code: 0,
-});
-
-itest!(info_type_import {
- args: "info info/info_type_import.ts",
- output: "info/info_type_import.out",
-});
-
-itest!(_054_info_local_imports {
- args: "info --quiet run/005_more_imports.ts",
- output: "info/054_info_local_imports.out",
- exit_code: 0,
-});
-
-// Tests for AssertionError where "data" is unexpectedly null when
-// a file contains only triple slash references (#11196)
-itest!(data_null_error {
- args: "info info/data_null_error/mod.ts",
- output: "info/data_null_error/data_null_error.out",
-});
-
-itest!(types_header_direct {
- args: "info --reload run/type_directives_01.ts",
- output: "info/types_header.out",
- http_server: true,
-});
-
-itest!(with_config_override {
- args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json",
- output: "info/with_config/with_config.out",
-});
-
-itest!(info_import_map {
- args: "info preact/debug",
- output: "info/with_import_map/with_import_map.out",
- cwd: Some("info/with_import_map"),
- copy_temp_dir: Some("info/with_import_map"),
- exit_code: 0,
-});
-
-itest!(info_dynamic_imports_tmpl_lit {
- args: "info compile/dynamic_imports_tmp_lit/main.js",
- output: "compile/dynamic_imports_tmp_lit/main.info.out",
- exit_code: 0,
-});
diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs
index 159663233..5cbe2a2ff 100644
--- a/tests/integration/mod.rs
+++ b/tests/integration/mod.rs
@@ -23,8 +23,6 @@ mod eval;
mod flags;
#[path = "fmt_tests.rs"]
mod fmt;
-#[path = "info_tests.rs"]
-mod info;
#[path = "init_tests.rs"]
mod init;
#[path = "inspector_tests.rs"]
diff --git a/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts b/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts
new file mode 100644
index 000000000..c69556be1
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/005_more_imports.ts
@@ -0,0 +1,11 @@
+import { printHello3, returnsFoo2, returnsHi } from "./mod1.ts";
+
+printHello3();
+
+if (returnsHi() !== "Hi") {
+ throw Error("Unexpected");
+}
+
+if (returnsFoo2() !== "Foo") {
+ throw Error("Unexpected");
+}
diff --git a/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out b/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out
new file mode 100644
index 000000000..388168a8b
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/054_info_local_imports.out
@@ -0,0 +1,9 @@
+local: [WILDCARD]005_more_imports.ts
+type: TypeScript
+dependencies: 3 unique
+size: [WILDCARD]
+
+file://[WILDCARD]/005_more_imports.ts ([WILDCARD])
+└─┬ file://[WILDCARD]/mod1.ts ([WILDCARD])
+ └─┬ file://[WILDCARD]/subdir2/mod2.ts ([WILDCARD])
+ └── file://[WILDCARD]/print_hello.ts ([WILDCARD])
diff --git a/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc b/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc
new file mode 100644
index 000000000..4bfdfe155
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "info --quiet 005_more_imports.ts",
+ "output": "054_info_local_imports.out",
+ "exitCode": 0
+}
diff --git a/tests/specs/info_tests/_054_info_local_imports/mod1.ts b/tests/specs/info_tests/_054_info_local_imports/mod1.ts
new file mode 100644
index 000000000..5e58f432e
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/mod1.ts
@@ -0,0 +1,17 @@
+import { printHello2, returnsFoo } from "./subdir2/mod2.ts";
+
+export function returnsHi(): string {
+ return "Hi";
+}
+
+export function returnsFoo2(): string {
+ return returnsFoo();
+}
+
+export function printHello3() {
+ printHello2();
+}
+
+export function throwsError() {
+ throw Error("exception from mod1");
+}
diff --git a/tests/specs/info_tests/_054_info_local_imports/mod2.ts b/tests/specs/info_tests/_054_info_local_imports/mod2.ts
new file mode 100644
index 000000000..ce1adc0e8
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/mod2.ts
@@ -0,0 +1 @@
+export { printHello } from "./print_hello.ts";
diff --git a/tests/specs/info_tests/_054_info_local_imports/print_hello.ts b/tests/specs/info_tests/_054_info_local_imports/print_hello.ts
new file mode 100644
index 000000000..b9c0ad527
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/print_hello.ts
@@ -0,0 +1,3 @@
+export function printHello() {
+ console.log("Hello");
+}
diff --git a/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts b/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts
new file mode 100644
index 000000000..59beb64c3
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/subdir2/dynamic_import.ts
@@ -0,0 +1,4 @@
+(async () => {
+ const { printHello } = await import("../mod2.ts");
+ printHello();
+})();
diff --git a/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts b/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts
new file mode 100644
index 000000000..9071d0aeb
--- /dev/null
+++ b/tests/specs/info_tests/_054_info_local_imports/subdir2/mod2.ts
@@ -0,0 +1,9 @@
+import { printHello } from "../print_hello.ts";
+
+export function returnsFoo(): string {
+ return "Foo";
+}
+
+export function printHello2() {
+ printHello();
+}
diff --git a/tests/specs/info_tests/data_null_error/__test__.jsonc b/tests/specs/info_tests/data_null_error/__test__.jsonc
new file mode 100644
index 000000000..782cca43d
--- /dev/null
+++ b/tests/specs/info_tests/data_null_error/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info data_null_error/mod.ts",
+ "output": "data_null_error/data_null_error.out"
+}
diff --git a/tests/testdata/info/data_null_error/data_null_error.out b/tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out
index 065396f18..065396f18 100644
--- a/tests/testdata/info/data_null_error/data_null_error.out
+++ b/tests/specs/info_tests/data_null_error/data_null_error/data_null_error.out
diff --git a/tests/testdata/info/data_null_error/mod.ts b/tests/specs/info_tests/data_null_error/data_null_error/mod.ts
index 6e3e99bd4..6e3e99bd4 100644
--- a/tests/testdata/info/data_null_error/mod.ts
+++ b/tests/specs/info_tests/data_null_error/data_null_error/mod.ts
diff --git a/tests/testdata/info/data_null_error/types.d.ts b/tests/specs/info_tests/data_null_error/data_null_error/types.d.ts
index 6ecc85676..6ecc85676 100644
--- a/tests/testdata/info/data_null_error/types.d.ts
+++ b/tests/specs/info_tests/data_null_error/data_null_error/types.d.ts
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc
new file mode 100644
index 000000000..71f823a46
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "info dynamic_imports_tmp_lit/main.js",
+ "output": "dynamic_imports_tmp_lit/main.info.out",
+ "exitCode": 0
+}
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out
new file mode 100644
index 000000000..57d730a64
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.info.out
@@ -0,0 +1,10 @@
+local: [WILDCARD]main.js
+type: JavaScript
+dependencies: 4 unique
+size: [WILDCARD]
+
+file:///[WILDCARD]/dynamic_imports_tmp_lit/main.js ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/a.js ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/sub/b.ts ([WILDCARD])
+├── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/data.json ([WILDCARD])
+└── file:///[WILDCARD]/dynamic_imports_tmp_lit/other/sub/data2.json ([WILDCARD])
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js
new file mode 100644
index 000000000..3bda59772
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/main.js
@@ -0,0 +1,14 @@
+const fileNames = [
+ "a.js",
+ "b.ts",
+];
+
+for (const fileName of fileNames) {
+ await import(`./sub/${fileName}`);
+}
+
+const jsonFileNames = ["data.json", "sub/data2.json"];
+for (const fileName of jsonFileNames) {
+ const mod = await import(`./other/${fileName}`, { with: { type: "json" } });
+ console.log(mod.default);
+}
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json
new file mode 100644
index 000000000..0131e01e4
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/data.json
@@ -0,0 +1,3 @@
+{
+ "data": 5
+}
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json
new file mode 100644
index 000000000..858a13cdd
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/other/sub/data2.json
@@ -0,0 +1,3 @@
+{
+ "data": 1
+}
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js
new file mode 100644
index 000000000..7b2a34601
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/a.js
@@ -0,0 +1 @@
+console.log("a");
diff --git a/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts
new file mode 100644
index 000000000..6d012e7f1
--- /dev/null
+++ b/tests/specs/info_tests/info_dynamic_imports_tmpl_lit/dynamic_imports_tmp_lit/sub/b.ts
@@ -0,0 +1 @@
+console.log("b");
diff --git a/tests/testdata/info/041_info_flag.out b/tests/specs/info_tests/info_flag/041_info_flag.out
index 3506a29e4..3506a29e4 100644
--- a/tests/testdata/info/041_info_flag.out
+++ b/tests/specs/info_tests/info_flag/041_info_flag.out
diff --git a/tests/specs/info_tests/info_flag/__test__.jsonc b/tests/specs/info_tests/info_flag/__test__.jsonc
new file mode 100644
index 000000000..39b50c960
--- /dev/null
+++ b/tests/specs/info_tests/info_flag/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info",
+ "output": "041_info_flag.out"
+}
diff --git a/tests/testdata/info/041_info_flag_location.out b/tests/specs/info_tests/info_flag_location/041_info_flag_location.out
index b9e72f659..b9e72f659 100644
--- a/tests/testdata/info/041_info_flag_location.out
+++ b/tests/specs/info_tests/info_flag_location/041_info_flag_location.out
diff --git a/tests/specs/info_tests/info_flag_location/__test__.jsonc b/tests/specs/info_tests/info_flag_location/__test__.jsonc
new file mode 100644
index 000000000..436e7cd9a
--- /dev/null
+++ b/tests/specs/info_tests/info_flag_location/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info --location https://deno.land",
+ "output": "041_info_flag_location.out"
+}
diff --git a/tests/testdata/info/049_info_flag_script_jsx.out b/tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out
index f49fc2356..f49fc2356 100644
--- a/tests/testdata/info/049_info_flag_script_jsx.out
+++ b/tests/specs/info_tests/info_flag_script_jsx/049_info_flag_script_jsx.out
diff --git a/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc b/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc
new file mode 100644
index 000000000..b8dc305ae
--- /dev/null
+++ b/tests/specs/info_tests/info_flag_script_jsx/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info http://127.0.0.1:4545/run/048_media_types_jsx.ts",
+ "output": "049_info_flag_script_jsx.out"
+}
diff --git a/tests/specs/info_tests/info_import_map/__test__.jsonc b/tests/specs/info_tests/info_import_map/__test__.jsonc
new file mode 100644
index 000000000..725276925
--- /dev/null
+++ b/tests/specs/info_tests/info_import_map/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "info preact/debug",
+ "output": "with_import_map.out",
+ "exitCode": 0
+}
diff --git a/tests/testdata/info/with_import_map/deno.json b/tests/specs/info_tests/info_import_map/deno.json
index aaf7260c6..aaf7260c6 100644
--- a/tests/testdata/info/with_import_map/deno.json
+++ b/tests/specs/info_tests/info_import_map/deno.json
diff --git a/tests/testdata/info/with_import_map/deno.lock b/tests/specs/info_tests/info_import_map/deno.lock
index cb5c6ca45..cb5c6ca45 100644
--- a/tests/testdata/info/with_import_map/deno.lock
+++ b/tests/specs/info_tests/info_import_map/deno.lock
diff --git a/tests/testdata/info/with_import_map/main.tsx b/tests/specs/info_tests/info_import_map/main.tsx
index e38f14a58..e38f14a58 100644
--- a/tests/testdata/info/with_import_map/main.tsx
+++ b/tests/specs/info_tests/info_import_map/main.tsx
diff --git a/tests/testdata/info/with_import_map/with_import_map.out b/tests/specs/info_tests/info_import_map/with_import_map.out
index 29dc17737..29dc17737 100644
--- a/tests/testdata/info/with_import_map/with_import_map.out
+++ b/tests/specs/info_tests/info_import_map/with_import_map.out
diff --git a/tests/specs/info_tests/info_json/__test__.jsonc b/tests/specs/info_tests/info_json/__test__.jsonc
new file mode 100644
index 000000000..4b50dc32b
--- /dev/null
+++ b/tests/specs/info_tests/info_json/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info --json",
+ "output": "info_json.out"
+}
diff --git a/tests/testdata/info/info_json.out b/tests/specs/info_tests/info_json/info_json.out
index 607489ca3..607489ca3 100644
--- a/tests/testdata/info/info_json.out
+++ b/tests/specs/info_tests/info_json/info_json.out
diff --git a/tests/testdata/info/076_info_json_deps_order.out b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out
index 33d58da16..33d58da16 100644
--- a/tests/testdata/info/076_info_json_deps_order.out
+++ b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.out
diff --git a/tests/testdata/info/076_info_json_deps_order.ts b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts
index b1ae75e68..b1ae75e68 100644
--- a/tests/testdata/info/076_info_json_deps_order.ts
+++ b/tests/specs/info_tests/info_json_deps_order/076_info_json_deps_order.ts
diff --git a/tests/specs/info_tests/info_json_deps_order/__test__.jsonc b/tests/specs/info_tests/info_json_deps_order/__test__.jsonc
new file mode 100644
index 000000000..f474f4d38
--- /dev/null
+++ b/tests/specs/info_tests/info_json_deps_order/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info --json 076_info_json_deps_order.ts",
+ "output": "076_info_json_deps_order.out"
+}
diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts
new file mode 100644
index 000000000..43ecdbe5e
--- /dev/null
+++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/A.ts
@@ -0,0 +1,7 @@
+import { B } from "./B.ts";
+import { thing } from "./common.ts";
+
+export function A() {
+ thing();
+ B();
+}
diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts
new file mode 100644
index 000000000..9fff0fdc9
--- /dev/null
+++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/B.ts
@@ -0,0 +1,7 @@
+import { C } from "./C.ts";
+import { thing } from "./common.ts";
+
+export function B() {
+ thing();
+ C();
+}
diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts
new file mode 100644
index 000000000..e47e77b41
--- /dev/null
+++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/C.ts
@@ -0,0 +1,8 @@
+import { A } from "./A.ts";
+import { thing } from "./common.ts";
+
+export function C() {
+ if (A != null) {
+ thing();
+ }
+}
diff --git a/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts b/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts
new file mode 100644
index 000000000..2b16a7bf1
--- /dev/null
+++ b/tests/specs/info_tests/info_json_deps_order/recursive_imports/common.ts
@@ -0,0 +1,2 @@
+export function thing() {
+}
diff --git a/tests/specs/info_tests/info_json_location/__test__.jsonc b/tests/specs/info_tests/info_json_location/__test__.jsonc
new file mode 100644
index 000000000..0c1acc3d9
--- /dev/null
+++ b/tests/specs/info_tests/info_json_location/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info --json --location https://deno.land",
+ "output": "info_json_location.out"
+}
diff --git a/tests/testdata/info/info_json_location.out b/tests/specs/info_tests/info_json_location/info_json_location.out
index 004bf03db..004bf03db 100644
--- a/tests/testdata/info/info_json_location.out
+++ b/tests/specs/info_tests/info_json_location/info_json_location.out
diff --git a/tests/specs/info_tests/info_missing_module/__test__.jsonc b/tests/specs/info_tests/info_missing_module/__test__.jsonc
new file mode 100644
index 000000000..edc151972
--- /dev/null
+++ b/tests/specs/info_tests/info_missing_module/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info error_009_missing_js_module.js",
+ "output": "info_missing_module.out"
+}
diff --git a/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js b/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js
new file mode 100644
index 000000000..e6ca88934
--- /dev/null
+++ b/tests/specs/info_tests/info_missing_module/error_009_missing_js_module.js
@@ -0,0 +1 @@
+import "./bad-module.js";
diff --git a/tests/testdata/info/info_missing_module.out b/tests/specs/info_tests/info_missing_module/info_missing_module.out
index c62d690c1..c62d690c1 100644
--- a/tests/testdata/info/info_missing_module.out
+++ b/tests/specs/info_tests/info_missing_module/info_missing_module.out
diff --git a/tests/specs/info_tests/info_recursive_modules/__test__.jsonc b/tests/specs/info_tests/info_recursive_modules/__test__.jsonc
new file mode 100644
index 000000000..c4313a2fb
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "info --quiet info_recursive_imports_test.ts",
+ "output": "info_recursive_imports_test.out",
+ "exitCode": 0
+}
diff --git a/tests/testdata/info/info_recursive_imports_test.out b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out
index 3340f3859..3340f3859 100644
--- a/tests/testdata/info/info_recursive_imports_test.out
+++ b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.out
diff --git a/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts
new file mode 100644
index 000000000..c9ba44755
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/info_recursive_imports_test.ts
@@ -0,0 +1,5 @@
+import { A } from "./recursive_imports/A.ts";
+
+export function test() {
+ A();
+}
diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts
new file mode 100644
index 000000000..43ecdbe5e
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/A.ts
@@ -0,0 +1,7 @@
+import { B } from "./B.ts";
+import { thing } from "./common.ts";
+
+export function A() {
+ thing();
+ B();
+}
diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts
new file mode 100644
index 000000000..9fff0fdc9
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/B.ts
@@ -0,0 +1,7 @@
+import { C } from "./C.ts";
+import { thing } from "./common.ts";
+
+export function B() {
+ thing();
+ C();
+}
diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts
new file mode 100644
index 000000000..e47e77b41
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/C.ts
@@ -0,0 +1,8 @@
+import { A } from "./A.ts";
+import { thing } from "./common.ts";
+
+export function C() {
+ if (A != null) {
+ thing();
+ }
+}
diff --git a/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts b/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts
new file mode 100644
index 000000000..2b16a7bf1
--- /dev/null
+++ b/tests/specs/info_tests/info_recursive_modules/recursive_imports/common.ts
@@ -0,0 +1,2 @@
+export function thing() {
+}
diff --git a/tests/specs/info_tests/info_type_import/__test__.jsonc b/tests/specs/info_tests/info_type_import/__test__.jsonc
new file mode 100644
index 000000000..2092ecf08
--- /dev/null
+++ b/tests/specs/info_tests/info_type_import/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info info_type_import.ts",
+ "output": "info_type_import.out"
+}
diff --git a/tests/testdata/info/info_type_import.out b/tests/specs/info_tests/info_type_import/info_type_import.out
index 0423efe82..0423efe82 100644
--- a/tests/testdata/info/info_type_import.out
+++ b/tests/specs/info_tests/info_type_import/info_type_import.out
diff --git a/tests/specs/info_tests/info_type_import/info_type_import.ts b/tests/specs/info_tests/info_type_import/info_type_import.ts
new file mode 100644
index 000000000..5d8ca21ce
--- /dev/null
+++ b/tests/specs/info_tests/info_type_import/info_type_import.ts
@@ -0,0 +1,3 @@
+import { AnInterface as _, isAnInterface } from "./type_and_code.ts";
+
+isAnInterface({});
diff --git a/tests/specs/info_tests/info_type_import/type_and_code.ts b/tests/specs/info_tests/info_type_import/type_and_code.ts
new file mode 100644
index 000000000..b14713419
--- /dev/null
+++ b/tests/specs/info_tests/info_type_import/type_and_code.ts
@@ -0,0 +1,7 @@
+export interface AnInterface {
+ a: string;
+}
+
+export function isAnInterface(value: unknown): value is AnInterface {
+ return value && typeof value === "object" && "a" in value;
+}
diff --git a/tests/specs/info_tests/json_file/__test__.jsonc b/tests/specs/info_tests/json_file/__test__.jsonc
new file mode 100644
index 000000000..61289da94
--- /dev/null
+++ b/tests/specs/info_tests/json_file/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "info --quiet --json json_output/main.ts",
+ "output": "json_output/main.out",
+ "exitCode": 0
+}
diff --git a/tests/testdata/info/json_output/main.out b/tests/specs/info_tests/json_file/json_output/main.out
index 43c4f7398..d4c2f234d 100644
--- a/tests/testdata/info/json_output/main.out
+++ b/tests/specs/info_tests/json_file/json_output/main.out
@@ -1,15 +1,15 @@
{
"roots": [
- "file://[WILDCARD]/info/json_output/main.ts"
+ "file://[WILDCARD]/json_output/main.ts"
],
"modules": [
{
"kind": "esm",
"dependencies": [
{
- "specifier": "../../subdir/mod1.ts",
+ "specifier": "../mod1.ts",
"code": {
- "specifier": "file://[WILDCARD]/subdir/mod1.ts",
+ "specifier": "file://[WILDCARD]/mod1.ts",
"span": {
"start": {
"line": 0,
@@ -17,7 +17,7 @@
},
"end": {
"line": 0,
- "character": 74
+ "character": 64
}
}
}
@@ -34,7 +34,7 @@
{
"specifier": "./subdir2/mod2.ts",
"code": {
- "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts",
+ "specifier": "file://[WILDCARD]/subdir2/mod2.ts",
"span": {
"start": {
"line": 0,
@@ -51,14 +51,14 @@
"local": "[WILDCARD]mod1.ts",
[WILDCARD]
"mediaType": "TypeScript",
- "specifier": "file://[WILDCARD]/subdir/mod1.ts"
+ "specifier": "file://[WILDCARD]/mod1.ts"
},
{
"kind": "esm",
"local": "[WILDCARD]print_hello.ts",
[WILDCARD]
"mediaType": "TypeScript",
- "specifier": "file://[WILDCARD]/subdir/print_hello.ts"
+ "specifier": "file://[WILDCARD]/print_hello.ts"
},
{
"kind": "esm",
@@ -66,7 +66,7 @@
{
"specifier": "../print_hello.ts",
"code": {
- "specifier": "file://[WILDCARD]/subdir/print_hello.ts",
+ "specifier": "file://[WILDCARD]/print_hello.ts",
"span": {
"start": {
"line": 0,
@@ -83,7 +83,7 @@
"local": "[WILDCARD]mod2.ts",
[WILDCARD]
"mediaType": "TypeScript",
- "specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts"
+ "specifier": "file://[WILDCARD]/subdir2/mod2.ts"
}
],
"redirects": {},
diff --git a/tests/testdata/info/json_output/main.ts b/tests/specs/info_tests/json_file/json_output/main.ts
index 927bc55ed..d9029af8a 100644
--- a/tests/testdata/info/json_output/main.ts
+++ b/tests/specs/info_tests/json_file/json_output/main.ts
@@ -1,4 +1,4 @@
-import { printHello3, returnsFoo2, returnsHi } from "../../subdir/mod1.ts";
+import { printHello3, returnsFoo2, returnsHi } from "../mod1.ts";
printHello3();
diff --git a/tests/specs/info_tests/json_file/mod1.ts b/tests/specs/info_tests/json_file/mod1.ts
new file mode 100644
index 000000000..5e58f432e
--- /dev/null
+++ b/tests/specs/info_tests/json_file/mod1.ts
@@ -0,0 +1,17 @@
+import { printHello2, returnsFoo } from "./subdir2/mod2.ts";
+
+export function returnsHi(): string {
+ return "Hi";
+}
+
+export function returnsFoo2(): string {
+ return returnsFoo();
+}
+
+export function printHello3() {
+ printHello2();
+}
+
+export function throwsError() {
+ throw Error("exception from mod1");
+}
diff --git a/tests/specs/info_tests/json_file/mod2.ts b/tests/specs/info_tests/json_file/mod2.ts
new file mode 100644
index 000000000..ce1adc0e8
--- /dev/null
+++ b/tests/specs/info_tests/json_file/mod2.ts
@@ -0,0 +1 @@
+export { printHello } from "./print_hello.ts";
diff --git a/tests/specs/info_tests/json_file/print_hello.ts b/tests/specs/info_tests/json_file/print_hello.ts
new file mode 100644
index 000000000..b9c0ad527
--- /dev/null
+++ b/tests/specs/info_tests/json_file/print_hello.ts
@@ -0,0 +1,3 @@
+export function printHello() {
+ console.log("Hello");
+}
diff --git a/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts b/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts
new file mode 100644
index 000000000..59beb64c3
--- /dev/null
+++ b/tests/specs/info_tests/json_file/subdir2/dynamic_import.ts
@@ -0,0 +1,4 @@
+(async () => {
+ const { printHello } = await import("../mod2.ts");
+ printHello();
+})();
diff --git a/tests/specs/info_tests/json_file/subdir2/mod2.ts b/tests/specs/info_tests/json_file/subdir2/mod2.ts
new file mode 100644
index 000000000..9071d0aeb
--- /dev/null
+++ b/tests/specs/info_tests/json_file/subdir2/mod2.ts
@@ -0,0 +1,9 @@
+import { printHello } from "../print_hello.ts";
+
+export function returnsFoo(): string {
+ return "Foo";
+}
+
+export function printHello2() {
+ printHello();
+}
diff --git a/tests/specs/info_tests/multiple_imports/__test__.jsonc b/tests/specs/info_tests/multiple_imports/__test__.jsonc
new file mode 100644
index 000000000..b110b2d4c
--- /dev/null
+++ b/tests/specs/info_tests/multiple_imports/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info http://127.0.0.1:4545/run/019_media_types.ts",
+ "output": "multiple_imports.out"
+}
diff --git a/tests/testdata/info/multiple_imports.out b/tests/specs/info_tests/multiple_imports/multiple_imports.out
index cb13318ca..cb13318ca 100644
--- a/tests/testdata/info/multiple_imports.out
+++ b/tests/specs/info_tests/multiple_imports/multiple_imports.out
diff --git a/tests/specs/info_tests/types_header_direct/__test__.jsonc b/tests/specs/info_tests/types_header_direct/__test__.jsonc
new file mode 100644
index 000000000..7f9b462ef
--- /dev/null
+++ b/tests/specs/info_tests/types_header_direct/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info --reload type_directives_01.ts",
+ "output": "types_header.out"
+}
diff --git a/tests/specs/info_tests/types_header_direct/type_directives_01.ts b/tests/specs/info_tests/types_header_direct/type_directives_01.ts
new file mode 100644
index 000000000..71305824c
--- /dev/null
+++ b/tests/specs/info_tests/types_header_direct/type_directives_01.ts
@@ -0,0 +1,3 @@
+import * as foo from "http://127.0.0.1:4545/xTypeScriptTypes.js";
+
+console.log(foo.foo);
diff --git a/tests/testdata/info/types_header.out b/tests/specs/info_tests/types_header_direct/types_header.out
index 722e02f77..722e02f77 100644
--- a/tests/testdata/info/types_header.out
+++ b/tests/specs/info_tests/types_header_direct/types_header.out
diff --git a/tests/specs/info_tests/with_config_override/__test__.jsonc b/tests/specs/info_tests/with_config_override/__test__.jsonc
new file mode 100644
index 000000000..02c7d2a78
--- /dev/null
+++ b/tests/specs/info_tests/with_config_override/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "info with_config/test.ts --config with_config/deno-override.json --import-map with_config/import_map.json",
+ "output": "with_config/with_config.out"
+}
diff --git a/tests/testdata/info/with_config/deno-override.json b/tests/specs/info_tests/with_config_override/with_config/deno-override.json
index ee44ba947..ee44ba947 100644
--- a/tests/testdata/info/with_config/deno-override.json
+++ b/tests/specs/info_tests/with_config_override/with_config/deno-override.json
diff --git a/tests/testdata/info/with_config/deno.json b/tests/specs/info_tests/with_config_override/with_config/deno.json
index 0967ef424..0967ef424 100644
--- a/tests/testdata/info/with_config/deno.json
+++ b/tests/specs/info_tests/with_config_override/with_config/deno.json
diff --git a/tests/testdata/info/with_config/import_map.json b/tests/specs/info_tests/with_config_override/with_config/import_map.json
index 0967ef424..0967ef424 100644
--- a/tests/testdata/info/with_config/import_map.json
+++ b/tests/specs/info_tests/with_config_override/with_config/import_map.json
diff --git a/tests/testdata/info/with_config/test.ts b/tests/specs/info_tests/with_config_override/with_config/test.ts
index 85ce559e8..85ce559e8 100644
--- a/tests/testdata/info/with_config/test.ts
+++ b/tests/specs/info_tests/with_config_override/with_config/test.ts
diff --git a/tests/testdata/info/with_config/with_config.out b/tests/specs/info_tests/with_config_override/with_config/with_config.out
index 95a1f30bc..95a1f30bc 100644
--- a/tests/testdata/info/with_config/with_config.out
+++ b/tests/specs/info_tests/with_config_override/with_config/with_config.out
diff --git a/tests/testdata/info/054_info_local_imports.out b/tests/testdata/info/054_info_local_imports.out
deleted file mode 100644
index ee1773b76..000000000
--- a/tests/testdata/info/054_info_local_imports.out
+++ /dev/null
@@ -1,9 +0,0 @@
-local: [WILDCARD]005_more_imports.ts
-type: TypeScript
-dependencies: 3 unique
-size: [WILDCARD]
-
-file://[WILDCARD]/005_more_imports.ts ([WILDCARD])
-└─┬ file://[WILDCARD]/subdir/mod1.ts ([WILDCARD])
- └─┬ file://[WILDCARD]/subdir/subdir2/mod2.ts ([WILDCARD])
- └── file://[WILDCARD]/subdir/print_hello.ts ([WILDCARD])
diff --git a/tools/lint.js b/tools/lint.js
index 013bd4930..bcbf1c27e 100755
--- a/tools/lint.js
+++ b/tools/lint.js
@@ -204,7 +204,6 @@ async function ensureNoNewITests() {
"eval_tests.rs": 0,
"flags_tests.rs": 0,
"fmt_tests.rs": 16,
- "info_tests.rs": 17,
"init_tests.rs": 0,
"inspector_tests.rs": 0,
"install_tests.rs": 0,