Skip to content

Commit

Permalink
respect skip and none releases for prereleases
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Jan 21, 2021
1 parent be24135 commit 1f96b1e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
27 changes: 27 additions & 0 deletions packages/core/src/__tests__/auto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,33 @@ describe("Auto", () => {
await auto.next({});
expect(afterRelease).toHaveBeenCalled();
});

test("respects none release labels", async () => {
const auto = new Auto({ ...defaults, plugins: [] });

// @ts-ignore
auto.checkClean = () => Promise.resolve(true);
auto.logger = dummyLog();
await auto.loadConfig();
auto.remote = "origin";
auto.git!.publish = () => Promise.resolve({ data: {} } as any);
auto.git!.getLastTagNotInBaseBranch = () =>
Promise.reject(new Error("Test"));
auto.git!.getLatestTagInBranch = () => Promise.reject(new Error("Test"));
auto.git!.getLatestRelease = () => Promise.resolve("abcd");
auto.release!.generateReleaseNotes = () => Promise.resolve("notes");
auto.release!.getCommitsInRelease = () =>
Promise.resolve([
makeCommitFromMsg("Test Commit", { labels: ["skip-release"] }),
]);

const next = jest.fn();
auto.hooks.next.tap("test", next);
jest.spyOn(auto.release!, "getCommits").mockImplementation();

await auto.next({});
expect(next).not.toHaveBeenCalled();
});
});

describe("shipit", () => {
Expand Down
9 changes: 6 additions & 3 deletions packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,9 +1383,12 @@ export default class Auto {
const commits = await this.release.getCommitsInRelease(lastTag);
const releaseNotes = await this.release.generateReleaseNotes(lastTag);
const labels = commits.map((commit) => commit.labels);
const bump =
calculateSemVerBump(labels, this.semVerLabels!, this.config) ||
SEMVER.patch;
const bump = calculateSemVerBump(labels, this.semVerLabels!, this.config);

if (bump === "") {
this.logger.log.info("No version published.");
return;
}

if (!args.quiet) {
this.logger.log.info("Full Release notes for next release:");
Expand Down

0 comments on commit 1f96b1e

Please sign in to comment.