Skip to content

Commit e4b1929

Browse files
committed
fix: override env.TRAVIS_PULL_REQUEST_BRANCH to fix PR checks on travis-ci
closes #11
1 parent a0329a8 commit e4b1929

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"scripts": {
2121
"watch": "jest --watchAll",
22-
"jest": "jest --coverage",
22+
"jest": "TRAVIS_PULL_REQUEST_BRANCH=master jest --coverage",
2323
"lint": "eslint ./",
2424
"lint:fix": "eslint --fix ./",
2525
"test": "yarn lint && yarn jest",

test/helpers/git.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const execa = require("execa");
99
const fileUrl = require("file-url");
1010
const gitLogParser = require("git-log-parser");
1111
const { array: getStreamArray } = require("get-stream");
12-
const envCi = require("env-ci");
1312

1413
/**
1514
* @typedef {Object} Commit
@@ -165,26 +164,6 @@ function gitPush(cwd, remote = "origin", branch = "master") {
165164

166165
// Branches.
167166

168-
/**
169-
* Return current git branch.
170-
* @param {string} cwd The CWD of the Git repository.
171-
* @returns {execa.ExecaSyncReturnValue} Branch name
172-
*/
173-
function gitReleaseBranch() {
174-
const ciCxt = envCi();
175-
const { prBranch, isPr } = ciCxt;
176-
177-
return isPr ? prBranch : "master";
178-
}
179-
180-
/**
181-
* Return the list of release branches.
182-
* @returns {string[]} Branch name
183-
*/
184-
function gitReleaseBranches() {
185-
return ["master"];
186-
}
187-
188167
/**
189168
* Create a branch in a local Git repository.
190169
*
@@ -336,6 +315,4 @@ module.exports = {
336315
gitGetTagHash,
337316
gitConfig,
338317
gitGetConfig,
339-
gitReleaseBranch,
340-
gitReleaseBranches,
341318
};

test/lib/multiSemanticRelease.test.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const {
1212
gitPush,
1313
gitTag,
1414
gitGetTags,
15-
gitReleaseBranches,
1615
} = require("../helpers/git");
1716

1817
// Clear mocks before tests.
@@ -26,7 +25,6 @@ describe("multiSemanticRelease()", () => {
2625
test("Initial commit (changes in all packages)", async () => {
2726
// Create Git repo with copy of Yarn workspaces fixture.
2827
const cwd = gitInit();
29-
const branches = gitReleaseBranches();
3028
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
3129
const sha = gitCommitAll(cwd, "feat: Initial release");
3230
const url = gitInitOrigin(cwd);
@@ -46,7 +44,7 @@ describe("multiSemanticRelease()", () => {
4644
`packages/c/package.json`,
4745
`packages/d/package.json`,
4846
],
49-
{ branches },
47+
{},
5048
{ cwd, stdout, stderr }
5149
);
5250

@@ -147,7 +145,6 @@ describe("multiSemanticRelease()", () => {
147145
test("No changes in any packages", async () => {
148146
// Create Git repo with copy of Yarn workspaces fixture.
149147
const cwd = gitInit();
150-
const branches = gitReleaseBranches();
151148
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
152149
const sha = gitCommitAll(cwd, "feat: Initial release");
153150
// Creating the four tags so there are no changes in any packages.
@@ -172,7 +169,7 @@ describe("multiSemanticRelease()", () => {
172169
`packages/d/package.json`,
173170
`packages/b/package.json`,
174171
],
175-
{ branches },
172+
{},
176173
{ cwd, stdout, stderr }
177174
);
178175

@@ -200,7 +197,6 @@ describe("multiSemanticRelease()", () => {
200197
test("Changes in some packages", async () => {
201198
// Create Git repo.
202199
const cwd = gitInit();
203-
const branches = gitReleaseBranches();
204200
// Initial commit.
205201
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
206202
const sha1 = gitCommitAll(cwd, "feat: Initial release");
@@ -228,7 +224,7 @@ describe("multiSemanticRelease()", () => {
228224
`packages/b/package.json`,
229225
`packages/a/package.json`,
230226
],
231-
{ branches },
227+
{},
232228
{ cwd, stdout, stderr }
233229
);
234230

@@ -336,7 +332,6 @@ describe("multiSemanticRelease()", () => {
336332
test("Error if release's local deps have no version number", async () => {
337333
// Create Git repo with copy of Yarn workspaces fixture.
338334
const cwd = gitInit();
339-
const branches = gitReleaseBranches();
340335
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
341336
gitAdd(cwd, "packages/a/package.json");
342337
const sha = gitCommit(cwd, "feat: Commit first package only");
@@ -352,7 +347,7 @@ describe("multiSemanticRelease()", () => {
352347
const multiSemanticRelease = require("../../");
353348
const result = await multiSemanticRelease(
354349
[`packages/a/package.json`, `packages/c/package.json`],
355-
{ branches },
350+
{},
356351
{ cwd, stdout, stderr }
357352
);
358353

@@ -365,7 +360,6 @@ describe("multiSemanticRelease()", () => {
365360
test("Configured plugins are called as normal", async () => {
366361
// Create Git repo with copy of Yarn workspaces fixture.
367362
const cwd = gitInit();
368-
const branches = gitReleaseBranches();
369363
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
370364
const sha = gitCommitAll(cwd, "feat: Initial release");
371365
const url = gitInitOrigin(cwd);
@@ -394,7 +388,6 @@ describe("multiSemanticRelease()", () => {
394388
// Override to add our own plugins.
395389
plugins: ["@semantic-release/release-notes-generator", plugin],
396390
analyzeCommits: ["@semantic-release/commit-analyzer"],
397-
branches,
398391
},
399392
{ cwd, stdout, stderr }
400393
);
@@ -411,7 +404,6 @@ describe("multiSemanticRelease()", () => {
411404
test("Deep errors (e.g. in plugins) bubble up and out", async () => {
412405
// Create Git repo with copy of Yarn workspaces fixture.
413406
const cwd = gitInit();
414-
const branches = gitReleaseBranches();
415407
copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd);
416408
const sha = gitCommitAll(cwd, "feat: Initial release");
417409
const url = gitInitOrigin(cwd);
@@ -438,7 +430,6 @@ describe("multiSemanticRelease()", () => {
438430
},
439431
},
440432
],
441-
branches,
442433
},
443434
{ cwd, stdout, stderr }
444435
);

0 commit comments

Comments
 (0)