Skip to content

Commit

Permalink
Merge pull request #1393 from 10hendersonm/master
Browse files Browse the repository at this point in the history
Fixes baseBranch from config
  • Loading branch information
hipstersmoothie authored Jul 20, 2020
2 parents 2566ec6 + c01e8d6 commit f18e3d3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions packages/core/src/__tests__/auto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@ describe("Auto", () => {
expect(auto.release).toBeDefined();
});

test("should set default baseBranch", async () => {
search.mockReturnValueOnce({
config: defaults,
});

const auto = new Auto();
auto.logger = dummyLog();
await auto.loadConfig();
expect(auto.baseBranch).toBe("master");
});

test("should set custom baseBranch", async () => {
search.mockReturnValueOnce({
config: {
...defaults,
baseBranch: "production",
},
});

const auto = new Auto();
auto.logger = dummyLog();
await auto.loadConfig();
expect(auto.baseBranch).toBe("production");
expect(auto.config?.baseBranch).toBe("production");
});

test("should default to npm in non-pkg", async () => {
search.mockReturnValueOnce({ config: defaults });
// @ts-ignore
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,10 @@ export default class Auto {
// This Line overrides config with args
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...omit(this.options, ["_command", "_all", "main"] as any),
baseBranch: this.baseBranch,
baseBranch: this.config.baseBranch || this.baseBranch,
};
this.config = config;
this.baseBranch = config.baseBranch;
const repository = await this.getRepo(config);
const token =
repository?.token || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
Expand Down

0 comments on commit f18e3d3

Please sign in to comment.