Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

definition-parser: include package name in error #60

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/definitions-parser/src/lib/definition-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function getTypingInfo(packageName: string, fs: FS): TypingsVersionsRaw {
if (matchesVersion(latestData, directoryVersion, considerLibraryMinorVersion)) {
const latest = `${latestData.libraryMajorVersion}.${latestData.libraryMinorVersion}`;
throw new Error(
`The latest version is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
`The latest version of the '${packageName}' package is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
(`v${latest}` === directoryName
? "."
: `; since it applies to any ${latestData.libraryMajorVersion}.* version, up to and including ${latest}.`)
Expand Down
4 changes: 2 additions & 2 deletions packages/definitions-parser/test/definition-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe(getTypingInfo, () => {
expect(() => {
getTypingInfo("jquery", dt.pkgFS("jquery"));
}).toThrow(
"The latest version is 3.3, so the subdirectory 'v3' is not allowed; " +
"The latest version of the 'jquery' package is 3.3, so the subdirectory 'v3' is not allowed; " +
"since it applies to any 3.* version, up to and including 3.3."
);
});
Expand All @@ -81,7 +81,7 @@ describe(getTypingInfo, () => {

expect(() => {
getTypingInfo("jquery", dt.pkgFS("jquery"));
}).toThrow("The latest version is 3.3, so the subdirectory 'v3.3' is not allowed.");
}).toThrow("The latest version of the 'jquery' package is 3.3, so the subdirectory 'v3.3' is not allowed.");
});

it("does not throw when a minor version is older than the latest", () => {
Expand Down