summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/npm_tests.rs82
-rw-r--r--cli/tests/testdata/npm/no_types_cjs/main.ts7
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/main.js6
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/package.json5
4 files changed, 63 insertions, 37 deletions
diff --git a/cli/tests/npm_tests.rs b/cli/tests/npm_tests.rs
index 9c53fdeac..99f11ba28 100644
--- a/cli/tests/npm_tests.rs
+++ b/cli/tests/npm_tests.rs
@@ -190,19 +190,19 @@ mod npm {
});
itest!(import_map {
- args: "run --allow-read --allow-env --import-map npm/import_map/import_map.json npm/import_map/main.js",
- output: "npm/import_map/main.out",
- envs: env_vars_for_npm_tests(),
- http_server: true,
-});
+ args: "run --allow-read --allow-env --import-map npm/import_map/import_map.json npm/import_map/main.js",
+ output: "npm/import_map/main.out",
+ envs: env_vars_for_npm_tests(),
+ http_server: true,
+ });
itest!(lock_file {
- args: "run --allow-read --allow-env --lock npm/lock_file/lock.json npm/lock_file/main.js",
- output: "npm/lock_file/main.out",
- envs: env_vars_for_npm_tests(),
- http_server: true,
- exit_code: 10,
-});
+ args: "run --allow-read --allow-env --lock npm/lock_file/lock.json npm/lock_file/main.js",
+ output: "npm/lock_file/main.out",
+ envs: env_vars_for_npm_tests(),
+ http_server: true,
+ exit_code: 10,
+ });
itest!(sub_paths {
args: "run -A --quiet npm/sub_paths/main.jsx",
@@ -296,12 +296,20 @@ mod npm {
});
itest!(types_ambient_module_import_map {
- args: "check --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_for_npm_tests(),
- http_server: true,
- exit_code: 1,
-});
+ args: "check --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_for_npm_tests(),
+ http_server: true,
+ exit_code: 1,
+ });
+
+ itest!(no_types_cjs {
+ args: "check --quiet npm/no_types_cjs/main.ts",
+ output_str: Some(""),
+ exit_code: 0,
+ envs: env_vars_for_npm_tests(),
+ http_server: true,
+ });
itest!(no_types_in_conditional_exports {
args: "run --check --unstable npm/no_types_in_conditional_exports/main.ts",
@@ -791,20 +799,20 @@ mod npm {
}
itest!(compile_errors {
- args: "compile -A --quiet npm/cached_only/main.ts",
- output_str: Some("error: npm specifiers have not yet been implemented for this sub command (https://github.com/denoland/deno/issues/15960). Found: npm:chalk@5\n"),
- exit_code: 1,
- envs: env_vars_for_npm_tests(),
- http_server: true,
-});
+ args: "compile -A --quiet npm/cached_only/main.ts",
+ output_str: Some("error: npm specifiers have not yet been implemented for this sub command (https://github.com/denoland/deno/issues/15960). Found: npm:chalk@5\n"),
+ exit_code: 1,
+ envs: env_vars_for_npm_tests(),
+ http_server: true,
+ });
itest!(bundle_errors {
- args: "bundle --quiet npm/esm/main.js",
- output_str: Some("error: npm specifiers have not yet been implemented for this sub command (https://github.com/denoland/deno/issues/15960). Found: npm:chalk@5\n"),
- exit_code: 1,
- envs: env_vars_for_npm_tests(),
- http_server: true,
-});
+ args: "bundle --quiet npm/esm/main.js",
+ output_str: Some("error: npm specifiers have not yet been implemented for this sub command (https://github.com/denoland/deno/issues/15960). Found: npm:chalk@5\n"),
+ exit_code: 1,
+ envs: env_vars_for_npm_tests(),
+ http_server: true,
+ });
itest!(info_chalk_display {
args: "info --quiet npm/cjs_with_deps/main.js",
@@ -832,14 +840,14 @@ mod npm {
});
itest!(info_chalk_json_node_modules_dir {
- args:
- "info --quiet --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_for_npm_tests(),
- http_server: true,
- temp_cwd: true,
-});
+ args:
+ "info --quiet --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_for_npm_tests(),
+ http_server: true,
+ temp_cwd: true,
+ });
itest!(info_cli_chalk_display {
args: "info --quiet npm:chalk@4",
diff --git a/cli/tests/testdata/npm/no_types_cjs/main.ts b/cli/tests/testdata/npm/no_types_cjs/main.ts
new file mode 100644
index 000000000..32458e839
--- /dev/null
+++ b/cli/tests/testdata/npm/no_types_cjs/main.ts
@@ -0,0 +1,7 @@
+import mod from "npm:@denotest/no-types-cjs";
+
+// it actually returns a `number` and has that in its
+// jsdocs, but the jsdocs should not have been resolved so
+// this should type check just fine
+const value: string = mod();
+console.log(value);
diff --git a/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/main.js b/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/main.js
new file mode 100644
index 000000000..bb6cbdb02
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/main.js
@@ -0,0 +1,6 @@
+/**
+ * @return {number}
+ */
+ module.exports = function () {
+ return 5;
+};
diff --git a/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/package.json
new file mode 100644
index 000000000..60b8a0285
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/no-types-cjs/1.0.0/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "@denotest/no-types-cjs",
+ "version": "1.0.0",
+ "main": "./main.js"
+}