diff options
| author | Kitson Kelly <me@kitsonkelly.com> | 2021-10-11 08:26:22 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-11 08:26:22 +1100 |
| commit | a7baf5f2bbb50dc0cb571de141b800b9155faca7 (patch) | |
| tree | 4bebaabd1d3ed4595e8a388e0fae559bb5558974 /cli/tests/testdata/compiler_api_test.ts | |
| parent | 5a8a989b7815023f33a1e3183a55cc8999af5d98 (diff) | |
refactor: integrate deno_graph into CLI (#12369)
Diffstat (limited to 'cli/tests/testdata/compiler_api_test.ts')
| -rw-r--r-- | cli/tests/testdata/compiler_api_test.ts | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/cli/tests/testdata/compiler_api_test.ts b/cli/tests/testdata/compiler_api_test.ts index 92eb4c519..b743a8612 100644 --- a/cli/tests/testdata/compiler_api_test.ts +++ b/cli/tests/testdata/compiler_api_test.ts @@ -313,10 +313,9 @@ Deno.test({ Deno.test({ name: "Deno.emit() - invalid syntax does not panic", async fn() { - await assertThrowsAsync(async () => { - await Deno.emit("/main.js", { - sources: { - "/main.js": ` + const { diagnostics } = await Deno.emit("/main.js", { + sources: { + "/main.js": ` export class Foo { constructor() { console.log("foo"); @@ -325,9 +324,14 @@ Deno.test({ console.log("bar"); } }`, - }, - }); + }, }); + assertEquals(diagnostics.length, 1); + assert( + diagnostics[0].messageText!.startsWith( + "The module's source code could not be parsed: Unexpected token `get`. Expected * for generator, private key, identifier or async at file:", + ), + ); }, }); @@ -356,12 +360,10 @@ Deno.test({ Deno.test({ name: "Deno.emit() - Unknown media type does not panic", async fn() { - await assertThrowsAsync(async () => { - await Deno.emit("https://example.com/foo", { - sources: { - "https://example.com/foo": `let foo: string = "foo";`, - }, - }); + await Deno.emit("https://example.com/foo", { + sources: { + "https://example.com/foo": `let foo: string = "foo";`, + }, }); }, }); @@ -487,7 +489,7 @@ Deno.test({ code: 900001, start: null, end: null, - messageText: "Unable to find specifier in sources: file:///b.ts", + messageText: 'Cannot load module "file:///b.ts".', messageChain: null, source: null, sourceLine: null, @@ -497,7 +499,7 @@ Deno.test({ ]); assert( Deno.formatDiagnostics(diagnostics).includes( - "Unable to find specifier in sources: file:///b.ts", + 'Cannot load module "file:///b.ts".', ), ); }, |
