Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Commit ad550b8

Browse files
feat(definition-parser): include package name in error
This proposed change is intended to allow developers quickly figure out the real reason of `getTypingInfo` failing due to version mismatch. Current error message and related stack trace does not contain a clue about the package failing and with the context of DT repository and local development artifacts, this removes the problem with definition parser failing on the stale data from local repository (non tracked folders, etc). Thanks!
1 parent 5873558 commit ad550b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/lib/definition-parser.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe(getTypingInfo, () => {
8181
expect(() => {
8282
getTypingInfo("jquery", dt.pkgFS("jquery"));
8383
}).toThrow(
84-
"The latest version is 3.3, so the subdirectory 'v3.3' is not allowed.",
84+
"The latest version of the 'jquery' package is 3.3, so the subdirectory 'v3.3' is not allowed.",
8585
);
8686
});
8787

src/lib/definition-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function getTypingInfo(packageName: string, fs: FS): TypingsVersionsRaw {
5252
if (matchesVersion(latestData, directoryVersion, considerLibraryMinorVersion)) {
5353
const latest = `${latestData.libraryMajorVersion}.${latestData.libraryMinorVersion}`;
5454
throw new Error(
55-
`The latest version is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
55+
`The latest version of the '${packageName}' package is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
5656
(`v${latest}` === directoryName ?
5757
"." : `; since it applies to any ${latestData.libraryMajorVersion}.* version, up to and including ${latest}.`),
5858
);

0 commit comments

Comments
 (0)