Skip to content

Commit 76109fc

Browse files
authored
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
1 parent dcae517 commit 76109fc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

__tests__/integration/errors.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test("integration - tsconfig errors", async () => {
3434
// TODO: move to parse-tsconfig unit tests?
3535
expect(genBundle("semantic.ts", {
3636
tsconfig: "non-existent-tsconfig",
37-
})).rejects.toThrow("rpt2: failed to open 'undefined'"); // FIXME: bug: this should be "non-existent-tsconfig", not "undefined"
37+
})).rejects.toThrow("rpt2: failed to open 'non-existent-tsconfig'");
3838
});
3939

4040
test("integration - semantic error", async () => {

src/parse-tsconfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions)
1515

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

2020
let loadedConfig: any = {};
2121
let baseDir = pluginOptions.cwd;

0 commit comments

Comments
 (0)