From b402b75c1de0497dd39a563cb7f5135d4ceb7fa7 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 10 Nov 2020 06:50:33 +1100 Subject: fix(cli): allow setting of importsNotUsedAsValues in Deno.compile() (#8306) Fixes #6663 --- cli/tests/compiler_api_test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cli/tests/compiler_api_test.ts') diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts index a236a3f3f..4535ad6ed 100644 --- a/cli/tests/compiler_api_test.ts +++ b/cli/tests/compiler_api_test.ts @@ -199,3 +199,24 @@ Deno.test({ }); }, }); + +Deno.test({ + name: `Deno.compile() - Allows setting of "importsNotUsedAsValues"`, + async fn() { + const [diagnostics] = await Deno.compile("/a.ts", { + "/a.ts": `import { B } from "./b.ts"; + const b: B = { b: "b" }; + `, + "/b.ts": `export interface B { + b: string; + }; + `, + }, { + importsNotUsedAsValues: "error", + }); + assert(diagnostics); + assertEquals(diagnostics.length, 1); + assert(diagnostics[0].messageText); + assert(diagnostics[0].messageText.includes("This import is never used")); + }, +}); -- cgit v1.2.3