Skip to content

Commit

Permalink
fix: missing tsconfig error shouldn't say undefined (#383)
Browse files Browse the repository at this point in the history
- per the conditional above this line, `file` is falsey, so printing it doesn't make sense
  - per same conditional though, `pluginOptions.tsconfig` exists, so we can print that

- fixes a test TODO/FIXME that had to workaround this bug as well
  • Loading branch information
agilgur5 authored Jul 12, 2022
1 parent dcae517 commit 76109fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/integration/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test("integration - tsconfig errors", async () => {
// TODO: move to parse-tsconfig unit tests?
expect(genBundle("semantic.ts", {
tsconfig: "non-existent-tsconfig",
})).rejects.toThrow("rpt2: failed to open 'undefined'"); // FIXME: bug: this should be "non-existent-tsconfig", not "undefined"
})).rejects.toThrow("rpt2: failed to open 'non-existent-tsconfig'");
});

test("integration - semantic error", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/parse-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions)

// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`rpt2: failed to open '${fileName}'`);
throw new Error(`rpt2: failed to open '${pluginOptions.tsconfig}'`);

let loadedConfig: any = {};
let baseDir = pluginOptions.cwd;
Expand Down

0 comments on commit 76109fc

Please sign in to comment.