fix: downcast from SwcDiagnosticBuffer to OpError (#6909)

This commit is contained in:
Bartek Iwańczuk 2020-07-28 21:08:13 +02:00 committed by GitHub
parent b7942bf0f6
commit 315efbc0e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 5 deletions

View file

@ -1,5 +1,9 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals } from "../../std/testing/asserts.ts";
import {
assert,
assertEquals,
assertThrowsAsync,
} from "../../std/testing/asserts.ts";
Deno.test({
name: "Deno.compile() - sources provided",
@ -33,7 +37,7 @@ Deno.test({
});
Deno.test({
name: "Deno.compile() - compiler options effects imit",
name: "Deno.compile() - compiler options effects emit",
async fn() {
const [diagnostics, actual] = await Deno.compile(
"/foo.ts",
@ -199,3 +203,23 @@ Deno.test({
assert(diagnostics.length === 1);
},
});
// See https://github.com/denoland/deno/issues/6908
Deno.test({
name: "Deno.compile() - SWC diagnostics",
async fn() {
await assertThrowsAsync(async () => {
await Deno.compile("main.js", {
"main.js": `
export class Foo {
constructor() {
console.log("foo");
}
export get() {
console.log("bar");
}
}`,
});
});
},
});