mirror of
https://github.com/chenasraf/DefinitelyTyped-tools.git
synced 2026-05-18 01:49:03 +00:00
Fix get latest match error format (#744)
* Fix getLatestMatch error format * add test
This commit is contained in:
committed by
Andrew Branch
parent
7c0b14d775
commit
32b0439b20
@@ -40,4 +40,9 @@ describe(TypingsVersions, () => {
|
||||
expect(versions.get({ major: 2, minor: 0 }).versionDirectoryName).toEqual("v2");
|
||||
expect(versions.get({ major: 2, minor: 0 }).subDirectoryPath).toEqual("jquery/v2");
|
||||
});
|
||||
|
||||
it("formats missing version error nicely", () => {
|
||||
expect(() => versions.get({ major: 111, minor: 1001 })).toThrow("Could not find version 111.1001");
|
||||
expect(() => versions.get({ major: 111 })).toThrow("Could not find version 111.*");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -479,7 +479,7 @@ export class TypingsVersions {
|
||||
private getLatestMatch(version: TypingVersion): TypingsData {
|
||||
const data = this.tryGetLatestMatch(version);
|
||||
if (!data) {
|
||||
throw new Error(`Could not find version ${version}`);
|
||||
throw new Error(`Could not find version ${version.major}.${version.minor ?? "*"}`);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user