From b5051e25c219c188f17d499ee4e101a64eb62e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 19 Aug 2024 21:36:35 +0100 Subject: feat: Deprecate "import assertions" with a warning (#24743) This commit deprecates "import assertions" proposal that has been replaced with "import attributes". Any time an import assertion is encountered a warning will be printed to the terminal. This warning will be printed for both local and remote files (ie. user code and dependencies). Import assertions support will be removed in Deno 2. --- tests/specs/future/import_assertions/__test__.jsonc | 9 +++++++++ tests/specs/future/import_assertions/success.out | 6 ++++++ 2 files changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/specs/future/import_assertions/__test__.jsonc b/tests/specs/future/import_assertions/__test__.jsonc index a1e759c75..1c55d2220 100644 --- a/tests/specs/future/import_assertions/__test__.jsonc +++ b/tests/specs/future/import_assertions/__test__.jsonc @@ -1,5 +1,14 @@ { "steps": [ + { + "args": "run main.js", + "output": "error.out", + "exitCode": 1, + "envs": { + "DENO_FUTURE": "1" + } + }, + // Running the same multiple times, should warn each time. { "args": "run main.js", "output": "error.out", diff --git a/tests/specs/future/import_assertions/success.out b/tests/specs/future/import_assertions/success.out index 70ec274d9..fcf28b943 100644 --- a/tests/specs/future/import_assertions/success.out +++ b/tests/specs/future/import_assertions/success.out @@ -1 +1,7 @@ +⚠️ Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword. + +import foo from "./main.json" assert { type: "json" }; + + at [WILDCARD]import_assertions/main.js:1:30 + { foo: "foo" } -- cgit v1.2.3