fix: missing tsconfig error shouldn't say undefined (#383)

- 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
This commit is contained in:
Anton Gilgur 2022-07-12 11:55:48 -04:00 committed by GitHub
parent dcae517e38
commit 76109fcfe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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 () => {

View File

@ -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;