summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-08-09 16:29:11 +0200
committerGitHub <noreply@github.com>2024-08-09 14:29:11 +0000
commit218ee1b1ffebbb53aa82c8ce55e7ee7061342249 (patch)
tree6eda062dbde889dcd7bd39fe0b8bf79d70b4b36b /tests/specs
parent4dc8fe20200b6bbdc93c30e49ebbeb161dbda85e (diff)
fix(add): Better error message when missing npm specifier (#24970)
Before: <img width="278" alt="Screenshot 2024-08-09 at 3 15 01 PM" src="https://github.com/user-attachments/assets/91b0ada6-93ee-4be6-a996-078aef98c2a9"> After: <img width="888" alt="Screenshot 2024-08-09 at 3 52 15 PM" src="https://github.com/user-attachments/assets/3c88a0e8-c761-4f70-88bf-109355ac12f0">
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/add/missing_npm_specifier/__test__.jsonc28
-rw-r--r--tests/specs/add/missing_npm_specifier/deno.json0
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/specs/add/missing_npm_specifier/__test__.jsonc b/tests/specs/add/missing_npm_specifier/__test__.jsonc
new file mode 100644
index 000000000..34cc61a37
--- /dev/null
+++ b/tests/specs/add/missing_npm_specifier/__test__.jsonc
@@ -0,0 +1,28 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "add ajv@latest",
+ "output": "error: jsr:ajv was not found, but a matching npm package exists. Did you mean `deno add npm:ajv@latest`?\n",
+ "exitCode": 1
+ },
+ {
+ "args": "add ajv",
+ "output": "error: jsr:ajv was not found, but a matching npm package exists. Did you mean `deno add npm:ajv`?\n",
+ "exitCode": 1
+ },
+ {
+ "args": "add ajv@8.11.0",
+ "output": "error: jsr:ajv was not found, but a matching npm package exists. Did you mean `deno add npm:ajv@8.11.0`?\n",
+ "exitCode": 1
+ },
+ {
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "args": "install ajv@latest",
+ "output": "error: jsr:ajv was not found, but a matching npm package exists. Did you mean `deno install npm:ajv@latest`?\n",
+ "exitCode": 1
+ }
+ ]
+}
diff --git a/tests/specs/add/missing_npm_specifier/deno.json b/tests/specs/add/missing_npm_specifier/deno.json
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/specs/add/missing_npm_specifier/deno.json