diff --git a/package.json b/package.json index a052fdc..bacc705 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ ], "scripts": { "watch": "jest --watchAll", - "jest": "jest --coverage", + "jest": "TRAVIS_PULL_REQUEST_BRANCH=master jest --coverage", "lint": "eslint ./", "lint:fix": "eslint --fix ./", "test": "yarn lint && yarn jest", diff --git a/test/helpers/git.js b/test/helpers/git.js index 6692860..e6ff6a3 100644 --- a/test/helpers/git.js +++ b/test/helpers/git.js @@ -9,7 +9,6 @@ const execa = require("execa"); const fileUrl = require("file-url"); const gitLogParser = require("git-log-parser"); const { array: getStreamArray } = require("get-stream"); -const envCi = require("env-ci"); /** * @typedef {Object} Commit @@ -165,26 +164,6 @@ function gitPush(cwd, remote = "origin", branch = "master") { // Branches. -/** - * Return current git branch. - * @param {string} cwd The CWD of the Git repository. - * @returns {execa.ExecaSyncReturnValue} Branch name - */ -function gitReleaseBranch() { - const ciCxt = envCi(); - const { prBranch, isPr } = ciCxt; - - return isPr ? prBranch : "master"; -} - -/** - * Return the list of release branches. - * @returns {string[]} Branch name - */ -function gitReleaseBranches() { - return ["master"]; -} - /** * Create a branch in a local Git repository. * @@ -336,6 +315,4 @@ module.exports = { gitGetTagHash, gitConfig, gitGetConfig, - gitReleaseBranch, - gitReleaseBranches, }; diff --git a/test/lib/multiSemanticRelease.test.js b/test/lib/multiSemanticRelease.test.js index ad16961..677d46f 100644 --- a/test/lib/multiSemanticRelease.test.js +++ b/test/lib/multiSemanticRelease.test.js @@ -12,7 +12,6 @@ const { gitPush, gitTag, gitGetTags, - gitReleaseBranches, } = require("../helpers/git"); // Clear mocks before tests. @@ -26,7 +25,6 @@ describe("multiSemanticRelease()", () => { test("Initial commit (changes in all packages)", async () => { // Create Git repo with copy of Yarn workspaces fixture. const cwd = gitInit(); - const branches = gitReleaseBranches(); copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); const sha = gitCommitAll(cwd, "feat: Initial release"); const url = gitInitOrigin(cwd); @@ -46,7 +44,7 @@ describe("multiSemanticRelease()", () => { `packages/c/package.json`, `packages/d/package.json`, ], - { branches }, + {}, { cwd, stdout, stderr } ); @@ -147,7 +145,6 @@ describe("multiSemanticRelease()", () => { test("No changes in any packages", async () => { // Create Git repo with copy of Yarn workspaces fixture. const cwd = gitInit(); - const branches = gitReleaseBranches(); copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); const sha = gitCommitAll(cwd, "feat: Initial release"); // Creating the four tags so there are no changes in any packages. @@ -172,7 +169,7 @@ describe("multiSemanticRelease()", () => { `packages/d/package.json`, `packages/b/package.json`, ], - { branches }, + {}, { cwd, stdout, stderr } ); @@ -200,7 +197,6 @@ describe("multiSemanticRelease()", () => { test("Changes in some packages", async () => { // Create Git repo. const cwd = gitInit(); - const branches = gitReleaseBranches(); // Initial commit. copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); const sha1 = gitCommitAll(cwd, "feat: Initial release"); @@ -228,7 +224,7 @@ describe("multiSemanticRelease()", () => { `packages/b/package.json`, `packages/a/package.json`, ], - { branches }, + {}, { cwd, stdout, stderr } ); @@ -336,7 +332,6 @@ describe("multiSemanticRelease()", () => { test("Error if release's local deps have no version number", async () => { // Create Git repo with copy of Yarn workspaces fixture. const cwd = gitInit(); - const branches = gitReleaseBranches(); copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); gitAdd(cwd, "packages/a/package.json"); const sha = gitCommit(cwd, "feat: Commit first package only"); @@ -352,7 +347,7 @@ describe("multiSemanticRelease()", () => { const multiSemanticRelease = require("../../"); const result = await multiSemanticRelease( [`packages/a/package.json`, `packages/c/package.json`], - { branches }, + {}, { cwd, stdout, stderr } ); @@ -365,7 +360,6 @@ describe("multiSemanticRelease()", () => { test("Configured plugins are called as normal", async () => { // Create Git repo with copy of Yarn workspaces fixture. const cwd = gitInit(); - const branches = gitReleaseBranches(); copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); const sha = gitCommitAll(cwd, "feat: Initial release"); const url = gitInitOrigin(cwd); @@ -394,7 +388,6 @@ describe("multiSemanticRelease()", () => { // Override to add our own plugins. plugins: ["@semantic-release/release-notes-generator", plugin], analyzeCommits: ["@semantic-release/commit-analyzer"], - branches, }, { cwd, stdout, stderr } ); @@ -411,7 +404,6 @@ describe("multiSemanticRelease()", () => { test("Deep errors (e.g. in plugins) bubble up and out", async () => { // Create Git repo with copy of Yarn workspaces fixture. const cwd = gitInit(); - const branches = gitReleaseBranches(); copyDirectory(`test/fixtures/yarnWorkspaces/`, cwd); const sha = gitCommitAll(cwd, "feat: Initial release"); const url = gitInitOrigin(cwd); @@ -438,7 +430,6 @@ describe("multiSemanticRelease()", () => { }, }, ], - branches, }, { cwd, stdout, stderr } );