summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/npm_tests.rs37
-rw-r--r--cli/tests/testdata/info/076_info_json_deps_order.out3
-rw-r--r--cli/tests/testdata/info/json_output/main.out3
-rw-r--r--cli/tests/testdata/npm/cjs_with_deps/main_info.out (renamed from cli/tests/testdata/npm/cjs_with_deps/main.info.out)0
-rw-r--r--cli/tests/testdata/npm/cjs_with_deps/main_info_json.out146
-rw-r--r--cli/tests/testdata/npm/info/chalk.out (renamed from cli/tests/testdata/npm/deno_info_chalk.out)0
-rw-r--r--cli/tests/testdata/npm/info/chalk_json.out54
7 files changed, 235 insertions, 8 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 0ca1ae910..714fe25d4 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -733,26 +733,51 @@ itest!(compile_errors {
http_server: true,
});
-itest!(info_chalk {
+itest!(info_chalk_display {
args: "info --quiet --unstable npm/cjs_with_deps/main.js",
- output: "npm/cjs_with_deps/main.info.out",
+ output: "npm/cjs_with_deps/main_info.out",
exit_code: 0,
envs: env_vars(),
http_server: true,
});
-itest!(info_chalk_node_modules_dir {
+itest!(info_chalk_display_node_modules_dir {
args: "info --quiet --unstable --node-modules-dir $TESTDATA/npm/cjs_with_deps/main.js",
- output: "npm/cjs_with_deps/main.info.out",
+ output: "npm/cjs_with_deps/main_info.out",
exit_code: 0,
envs: env_vars(),
http_server: true,
temp_cwd: true,
});
-itest!(info_cli_chalk {
+itest!(info_chalk_json {
+ args: "info --quiet --unstable --json npm/cjs_with_deps/main.js",
+ output: "npm/cjs_with_deps/main_info_json.out",
+ exit_code: 0,
+ envs: env_vars(),
+ http_server: true,
+});
+
+itest!(info_chalk_json_node_modules_dir {
+ args: "info --quiet --unstable --node-modules-dir --json $TESTDATA/npm/cjs_with_deps/main.js",
+ output: "npm/cjs_with_deps/main_info_json.out",
+ exit_code: 0,
+ envs: env_vars(),
+ http_server: true,
+ temp_cwd: true,
+});
+
+itest!(info_cli_chalk_display {
args: "info --quiet --unstable npm:chalk@4",
- output: "npm/deno_info_chalk.out",
+ output: "npm/info/chalk.out",
+ exit_code: 0,
+ envs: env_vars(),
+ http_server: true,
+});
+
+itest!(info_cli_chalk_json {
+ args: "info --quiet --unstable --json npm:chalk@4",
+ output: "npm/info/chalk_json.out",
exit_code: 0,
envs: env_vars(),
http_server: true,
diff --git a/cli/tests/testdata/info/076_info_json_deps_order.out b/cli/tests/testdata/info/076_info_json_deps_order.out
index db890ef02..98b5d5d50 100644
--- a/cli/tests/testdata/info/076_info_json_deps_order.out
+++ b/cli/tests/testdata/info/076_info_json_deps_order.out
@@ -159,5 +159,6 @@
"specifier": "file://[WILDCARD]/recursive_imports/common.ts"
}
],
- "redirects": {}
+ "redirects": {},
+ "npmPackages": {}
}
diff --git a/cli/tests/testdata/info/json_output/main.out b/cli/tests/testdata/info/json_output/main.out
index 124fc7351..aaef028c0 100644
--- a/cli/tests/testdata/info/json_output/main.out
+++ b/cli/tests/testdata/info/json_output/main.out
@@ -86,5 +86,6 @@
"specifier": "file://[WILDCARD]/subdir/subdir2/mod2.ts"
}
],
- "redirects": {}
+ "redirects": {},
+ "npmPackages": {}
}
diff --git a/cli/tests/testdata/npm/cjs_with_deps/main.info.out b/cli/tests/testdata/npm/cjs_with_deps/main_info.out
index 345583a90..345583a90 100644
--- a/cli/tests/testdata/npm/cjs_with_deps/main.info.out
+++ b/cli/tests/testdata/npm/cjs_with_deps/main_info.out
diff --git a/cli/tests/testdata/npm/cjs_with_deps/main_info_json.out b/cli/tests/testdata/npm/cjs_with_deps/main_info_json.out
new file mode 100644
index 000000000..bc7b9e162
--- /dev/null
+++ b/cli/tests/testdata/npm/cjs_with_deps/main_info_json.out
@@ -0,0 +1,146 @@
+{
+ "roots": [
+ "file://[WILDCARD]/main.js"
+ ],
+ "modules": [
+ {
+ "dependencies": [
+ {
+ "specifier": "npm:chai@4.3",
+ "code": {
+ "specifier": "npm:chai@4.3",
+ "span": {
+ "start": {
+ "line": 1,
+ "character": 23
+ },
+ "end": {
+ "line": 1,
+ "character": 37
+ }
+ }
+ },
+ "npmPackage": "chai@4.3.6"
+ },
+ {
+ "specifier": "npm:chalk@4",
+ "code": {
+ "specifier": "npm:chalk@4",
+ "span": {
+ "start": {
+ "line": 0,
+ "character": 18
+ },
+ "end": {
+ "line": 0,
+ "character": 31
+ }
+ }
+ },
+ "npmPackage": "chalk@4.1.2"
+ }
+ ],
+ "kind": "esm",
+ "local": "[WILDCARD]main.js",
+ "emit": null,
+ "map": null,
+ "size": 325,
+ "mediaType": "JavaScript",
+ "specifier": "[WILDCARD]/main.js"
+ }
+ ],
+ "redirects": {},
+ "npmPackages": {
+ "ansi-styles@4.3.0": {
+ "name": "ansi-styles",
+ "version": "4.3.0",
+ "dependencies": [
+ "color-convert@2.0.1"
+ ]
+ },
+ "assertion-error@1.1.0": {
+ "name": "assertion-error",
+ "version": "1.1.0",
+ "dependencies": []
+ },
+ "chai@4.3.6": {
+ "name": "chai",
+ "version": "4.3.6",
+ "dependencies": [
+ "assertion-error@1.1.0",
+ "check-error@1.0.2",
+ "deep-eql@3.0.1",
+ "get-func-name@2.0.0",
+ "loupe@2.3.4",
+ "pathval@1.1.1",
+ "type-detect@4.0.8"
+ ]
+ },
+ "chalk@4.1.2": {
+ "name": "chalk",
+ "version": "4.1.2",
+ "dependencies": [
+ "ansi-styles@4.3.0",
+ "supports-color@7.2.0"
+ ]
+ },
+ "check-error@1.0.2": {
+ "name": "check-error",
+ "version": "1.0.2",
+ "dependencies": []
+ },
+ "color-convert@2.0.1": {
+ "name": "color-convert",
+ "version": "2.0.1",
+ "dependencies": [
+ "color-name@1.1.4"
+ ]
+ },
+ "color-name@1.1.4": {
+ "name": "color-name",
+ "version": "1.1.4",
+ "dependencies": []
+ },
+ "deep-eql@3.0.1": {
+ "name": "deep-eql",
+ "version": "3.0.1",
+ "dependencies": [
+ "type-detect@4.0.8"
+ ]
+ },
+ "get-func-name@2.0.0": {
+ "name": "get-func-name",
+ "version": "2.0.0",
+ "dependencies": []
+ },
+ "has-flag@4.0.0": {
+ "name": "has-flag",
+ "version": "4.0.0",
+ "dependencies": []
+ },
+ "loupe@2.3.4": {
+ "name": "loupe",
+ "version": "2.3.4",
+ "dependencies": [
+ "get-func-name@2.0.0"
+ ]
+ },
+ "pathval@1.1.1": {
+ "name": "pathval",
+ "version": "1.1.1",
+ "dependencies": []
+ },
+ "supports-color@7.2.0": {
+ "name": "supports-color",
+ "version": "7.2.0",
+ "dependencies": [
+ "has-flag@4.0.0"
+ ]
+ },
+ "type-detect@4.0.8": {
+ "name": "type-detect",
+ "version": "4.0.8",
+ "dependencies": []
+ }
+ }
+}
diff --git a/cli/tests/testdata/npm/deno_info_chalk.out b/cli/tests/testdata/npm/info/chalk.out
index 89ea05e71..89ea05e71 100644
--- a/cli/tests/testdata/npm/deno_info_chalk.out
+++ b/cli/tests/testdata/npm/info/chalk.out
diff --git a/cli/tests/testdata/npm/info/chalk_json.out b/cli/tests/testdata/npm/info/chalk_json.out
new file mode 100644
index 000000000..f6673d032
--- /dev/null
+++ b/cli/tests/testdata/npm/info/chalk_json.out
@@ -0,0 +1,54 @@
+{
+ "roots": [
+ "npm:chalk@4"
+ ],
+ "modules": [
+ {
+ "kind": "npm",
+ "specifier": "npm:chalk@4",
+ "npmPackage": "chalk@4.1.2"
+ }
+ ],
+ "redirects": {},
+ "npmPackages": {
+ "ansi-styles@4.3.0": {
+ "name": "ansi-styles",
+ "version": "4.3.0",
+ "dependencies": [
+ "color-convert@2.0.1"
+ ]
+ },
+ "chalk@4.1.2": {
+ "name": "chalk",
+ "version": "4.1.2",
+ "dependencies": [
+ "ansi-styles@4.3.0",
+ "supports-color@7.2.0"
+ ]
+ },
+ "color-convert@2.0.1": {
+ "name": "color-convert",
+ "version": "2.0.1",
+ "dependencies": [
+ "color-name@1.1.4"
+ ]
+ },
+ "color-name@1.1.4": {
+ "name": "color-name",
+ "version": "1.1.4",
+ "dependencies": []
+ },
+ "has-flag@4.0.0": {
+ "name": "has-flag",
+ "version": "4.0.0",
+ "dependencies": []
+ },
+ "supports-color@7.2.0": {
+ "name": "supports-color",
+ "version": "7.2.0",
+ "dependencies": [
+ "has-flag@4.0.0"
+ ]
+ }
+ }
+}