From ea6179f7dce89416f1586ee18c2f437e68eabd38 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Fri, 7 Feb 2020 17:54:05 +1100 Subject: Improve support for diagnostics from runtime compiler APIs (#3911) - Exports diagnostic items from `diagnostics.ts` which are missing at runtime. - Returns an array of diagnostics, instead of an object with a property of `items`. This is because of the way Rust deals with certain structures, and shouldn't be exposed in the APIs. --- cli/js/compiler_api_test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/js/compiler_api_test.ts') diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts index 8d7bf57d3..72b65ab5d 100644 --- a/cli/js/compiler_api_test.ts +++ b/cli/js/compiler_api_test.ts @@ -103,3 +103,11 @@ test(async function bundleApiConfig() { assert(diagnostics == null); assert(!actual.includes(`random`)); }); + +test(async function diagnosticsTest() { + const [diagnostics] = await compile("/foo.ts", { + "/foo.ts": `document.getElementById("foo");` + }); + assert(Array.isArray(diagnostics)); + assert(diagnostics.length === 1); +}); -- cgit v1.2.3