diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-06-22 07:18:32 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 07:18:32 +1000 |
commit | 281c4cd8fcf5fd54f558a6922736def2c7804529 (patch) | |
tree | 65ac91c5a41a64dc0b85ee9c5949d7086e8620ef /cli/tests/compiler_api_test.ts | |
parent | cda15f2a98b10330422d1c8352d163d703ee6a49 (diff) |
feat(cli): support "types" when type checking (#10999)
Fixes #10677
Diffstat (limited to 'cli/tests/compiler_api_test.ts')
-rw-r--r-- | cli/tests/compiler_api_test.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts index 00116e7e1..b9a08d5ca 100644 --- a/cli/tests/compiler_api_test.ts +++ b/cli/tests/compiler_api_test.ts @@ -93,6 +93,56 @@ Deno.test({ }); Deno.test({ + name: "Deno.emit() - type references can be loaded", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///a.ts", + { + sources: { + "file:///a.ts": `/// <reference types="./b.d.ts" /> + const b = new B(); + console.log(b.b);`, + "file:///b.d.ts": `declare class B { + b: string; + }`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); + }, +}); + +Deno.test({ + name: "Deno.emit() - compilerOptions.types", + async fn() { + const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( + "file:///a.ts", + { + compilerOptions: { + types: ["file:///b.d.ts"], + }, + sources: { + "file:///a.ts": `const b = new B(); + console.log(b.b);`, + "file:///b.d.ts": `declare class B { + b: string; + }`, + }, + }, + ); + assertEquals(diagnostics.length, 0); + assert(!ignoredOptions); + assertEquals(stats.length, 12); + const keys = Object.keys(files).sort(); + assertEquals(keys, ["file:///a.ts.js", "file:///a.ts.js.map"]); + }, +}); + +Deno.test({ name: "Deno.emit() - import maps", async fn() { const { diagnostics, files, ignoredOptions, stats } = await Deno.emit( |