Skip to content

Commit

Permalink
Resolve SNAPSHOT version - issue #82
Browse files Browse the repository at this point in the history
  • Loading branch information
bjuric committed Aug 4, 2024
1 parent d9232f2 commit 51e7213
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export default async function getDesiredVersion(
if (versionRange === "latest") {
console.log("No version specified, using latest");
return versionInfo.latestVersion;
} else if (versionRange.endsWith("-SNAPSHOT")) {
return versionRange;
} else {
const resolvedVersion = semverMaxSatisfying(
versionInfo.versions,
Expand Down
10 changes: 10 additions & 0 deletions test/version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ describe("getDesiredVersion", () => {
).resolves.toBe("2.0.0");
});

it("should return the SNAPSHOT version specified in package.json", async () => {
await expect(
getDesiredVersion({
...config,
version: "2.0.0-1-SNAPSHOT",
}),
).resolves.toBe("2.0.0-1-SNAPSHOT");
});


it("should return the latest version matching specified semver range", async () => {
await expect(
getDesiredVersion({
Expand Down

0 comments on commit 51e7213

Please sign in to comment.