summaryrefslogtreecommitdiff
path: root/tests/testdata
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-05 07:25:56 +0100
committerGitHub <noreply@github.com>2024-09-05 08:25:56 +0200
commitacd01eb2b41e37a480943f79cfa28fc220c4baca (patch)
treea9808419bc88099fc811162d000007f6b2c30f9d /tests/testdata
parent105c2e336a4312ed1714ab893c57eae2a19068c7 (diff)
feat: Add a hint on error about 'Relative import path ... not prefixed with ...' (#25430)
Running a file like: ``` import "@std/dotenv/load"; ``` Without a mapping in `imports` field of `deno.json` or `dependencies` of `package.json` will now error out with a hint: ``` error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../ hint: Try running `deno add @std/dotenv/load` at [WILDCARD]bare_specifier_without_import/main.ts:1:8 ``` Closes https://github.com/denoland/deno/issues/24699 --------- Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Diffstat (limited to 'tests/testdata')
-rw-r--r--tests/testdata/run/error_type_definitions.ts.out1
-rw-r--r--tests/testdata/run/node_prefix_missing/main.ts.out2
-rw-r--r--tests/testdata/run/with_package_json/with_stop/main.out1
3 files changed, 3 insertions, 1 deletions
diff --git a/tests/testdata/run/error_type_definitions.ts.out b/tests/testdata/run/error_type_definitions.ts.out
index d60d4d483..7a71b4ebe 100644
--- a/tests/testdata/run/error_type_definitions.ts.out
+++ b/tests/testdata/run/error_type_definitions.ts.out
@@ -1,2 +1,3 @@
[WILDCARD]error: Failed resolving types. Relative import path "baz" not prefixed with / or ./ or ../
+ hint: If you want to use a JSR or npm package, try running `deno add baz`
at [WILDCARD]/type_definitions/bar.d.ts:[WILDCARD]
diff --git a/tests/testdata/run/node_prefix_missing/main.ts.out b/tests/testdata/run/node_prefix_missing/main.ts.out
index fd19ed55f..48b4e37e2 100644
--- a/tests/testdata/run/node_prefix_missing/main.ts.out
+++ b/tests/testdata/run/node_prefix_missing/main.ts.out
@@ -1,3 +1,3 @@
error: Relative import path "fs" not prefixed with / or ./ or ../
-If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
+ hint: If you want to use a built-in Node module, add a "node:" prefix (ex. "node:fs").
at file:///[WILDCARD]/main.ts:1:16
diff --git a/tests/testdata/run/with_package_json/with_stop/main.out b/tests/testdata/run/with_package_json/with_stop/main.out
index f5eb79ca6..afab4910c 100644
--- a/tests/testdata/run/with_package_json/with_stop/main.out
+++ b/tests/testdata/run/with_package_json/with_stop/main.out
@@ -1,4 +1,5 @@
[WILDCARD]Config file found at '[WILDCARD]with_package_json[WILDCARD]with_stop[WILDCARD]some[WILDCARD]nested[WILDCARD]deno.json'
[WILDCARD]
error: Relative import path "chalk" not prefixed with / or ./ or ../
+ hint: If you want to use a JSR or npm package, try running `deno add chalk`
at file:///[WILDCARD]with_package_json/with_stop/some/nested/dir/main.ts:3:19