From 218ee1b1ffebbb53aa82c8ce55e7ee7061342249 Mon Sep 17 00:00:00 2001
From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
Date: Fri, 9 Aug 2024 16:29:11 +0200
Subject: fix(add): Better error message when missing npm specifier (#24970)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Before:
After:
---
.../specs/add/missing_npm_specifier/__test__.jsonc | 28 ++++++++++++++++++++++
tests/specs/add/missing_npm_specifier/deno.json | 0
2 files changed, 28 insertions(+)
create mode 100644 tests/specs/add/missing_npm_specifier/__test__.jsonc
create mode 100644 tests/specs/add/missing_npm_specifier/deno.json
(limited to 'tests')
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
--
cgit v1.2.3