Skip to content

Commit

Permalink
fix: Fix tsconfig.json errors not propagating correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 16, 2021
1 parent 2ceab78 commit 0db0d33
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,15 @@ export default class Package {
fs.readFileSync(name, 'utf8'),
);

const host = {
getCanonicalFileName: (fileName: string) => fileName,
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
getNewLine: () => ts.sys.newLine,
};

// istanbul ignore next
if (error) {
throw error;
throw new Error(ts.formatDiagnostic(error, host));
}

const result = ts.parseJsonConfigFileContent(
Expand All @@ -267,7 +273,7 @@ export default class Package {

// istanbul ignore next
if (result.errors.length > 0) {
throw result.errors[0];
throw new Error(ts.formatDiagnostics(result.errors, host));
}

return result;
Expand Down

0 comments on commit 0db0d33

Please sign in to comment.