From 76109fcfe93dbbde5452121331920ff661465577 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Tue, 12 Jul 2022 11:55:48 -0400 Subject: [PATCH] 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 --- __tests__/integration/errors.spec.ts | 2 +- src/parse-tsconfig.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/integration/errors.spec.ts b/__tests__/integration/errors.spec.ts index 5838ed8..d44e09e 100644 --- a/__tests__/integration/errors.spec.ts +++ b/__tests__/integration/errors.spec.ts @@ -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 () => { diff --git a/src/parse-tsconfig.ts b/src/parse-tsconfig.ts index 7686dfc..b24a0bb 100644 --- a/src/parse-tsconfig.ts +++ b/src/parse-tsconfig.ts @@ -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;