diff --git a/README.md b/README.md index 6884c2a..46bc2b5 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Officially supported CI servers: | [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 | | [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ | | [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 | -| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | 🚫 | +| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ | | [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ | | [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ | | [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ | diff --git a/test.js b/test.js index ade6d1b..2a1c35e 100644 --- a/test.js +++ b/test.js @@ -127,6 +127,42 @@ test('Azure Pipelines - Not PR', function (t) { t.end() }) +test('Bitbucket Pipelines - PR', function (t) { + process.env.BITBUCKET_COMMIT = 'true' + process.env.BITBUCKET_PR_ID = '42' + + clearRequire('./') + var ci = require('./') + + t.equal(ci.isCI, true) + t.equal(ci.isPR, true) + t.equal(ci.name, 'Bitbucket Pipelines') + t.equal(ci.BITBUCKET, true) + assertVendorConstants('BITBUCKET', ci, t) + + delete process.env.BITBUCKET_COMMIT + delete process.env.BITBUCKET_PR_ID + + t.end() +}) + +test('Bitbucket Pipelines - Not PR', function (t) { + process.env.BITBUCKET_COMMIT = 'true' + + clearRequire('./') + var ci = require('./') + + t.equal(ci.isCI, true) + t.equal(ci.isPR, false) + t.equal(ci.name, 'Bitbucket Pipelines') + t.equal(ci.BITBUCKET, true) + assertVendorConstants('BITBUCKET', ci, t) + + delete process.env.BITBUCKET_COMMIT + + t.end() +}) + test('Buildkite - PR', function (t) { process.env.BUILDKITE = 'true' process.env.BUILDKITE_PULL_REQUEST = '42' diff --git a/vendors.json b/vendors.json index 187b787..3acdb67 100644 --- a/vendors.json +++ b/vendors.json @@ -19,7 +19,8 @@ { "name": "Bitbucket Pipelines", "constant": "BITBUCKET", - "env": "BITBUCKET_COMMIT" + "env": "BITBUCKET_COMMIT", + "pr": "BITBUCKET_PR_ID" }, { "name": "Bitrise",