fix(cli): allow setting of importsNotUsedAsValues in Deno.compile() (#8306)

Fixes #6663
This commit is contained in:
Kitson Kelly 2020-11-10 06:50:33 +11:00 committed by GitHub
parent 5375bf2e3f
commit b402b75c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -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"));
},
});