diff --git a/__tests__/integration/errors.spec.ts b/__tests__/integration/errors.spec.ts index 3ecacdec..8df614a9 100644 --- a/__tests__/integration/errors.spec.ts +++ b/__tests__/integration/errors.spec.ts @@ -88,3 +88,10 @@ test("integration - type-only import error - abortOnError: false / check: false" expect(output.length).toEqual(files.length); // no other files expect(onwarn).toBeCalledTimes(1); }); + +// integration test variant of parse-tsconfig unit test, to test how other hooks interact with an error thrown in buildStart +test("integration - tsconfig error", async () => { + await expect(genBundle("semantic.ts", { + tsconfigOverride: { compilerOptions: { module: "none" } }, + })).rejects.toThrow("Incompatible tsconfig option. Module resolves to 'None'. This is incompatible with Rollup, please use"); +}); diff --git a/src/index.ts b/src/index.ts index a4bcdb8c..8a625663 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,7 +79,7 @@ const typescript: PluginImpl = (options) => if (!watchMode && !noErrors) context.info(yellow("there were errors or warnings.")); - cache.done(); + cache?.done(); // if there's an initialization error in `buildStart`, such as a `tsconfig` error, the cache may not exist yet } const pluginOptions: IOptions = Object.assign({},