Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't error out while catching a buildStart error #422

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions __tests__/integration/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const typescript: PluginImpl<RPT2Options> = (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({},
Expand Down