Skip to content

Commit

Permalink
feat: add better support azure pipelines (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessehouwing authored Oct 4, 2023
1 parent 8e2b9d2 commit 5ea8d85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ test('AppVeyor - Not PR', function (t) {
})

test('Azure Pipelines - PR', function (t) {
process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI = 'https://dev.azure.com/Contoso'
process.env.SYSTEM_PULLREQUEST_PULLREQUESTID = '42'
process.env.TF_BUILD = 'true'
process.env.BUILD_REASON = 'PullRequest'

clearModule('./')
const ci = require('./')
Expand All @@ -136,14 +136,14 @@ test('Azure Pipelines - PR', function (t) {
t.equal(ci.AZURE_PIPELINES, true)
assertVendorConstants('AZURE_PIPELINES', ci, t)

delete process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
delete process.env.SYSTEM_PULLREQUEST_PULLREQUESTID
delete process.env.TF_BUILD
delete process.env.BUILD_REASON

t.end()
})

test('Azure Pipelines - Not PR', function (t) {
process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI = 'https://dev.azure.com/Contoso'
process.env.TF_BUILD = 'true'

clearModule('./')
const ci = require('./')
Expand All @@ -154,7 +154,7 @@ test('Azure Pipelines - Not PR', function (t) {
t.equal(ci.AZURE_PIPELINES, true)
assertVendorConstants('AZURE_PIPELINES', ci, t)

delete process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
delete process.env.TF_BUILD

t.end()
})
Expand Down
6 changes: 4 additions & 2 deletions vendors.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
{
"name": "Azure Pipelines",
"constant": "AZURE_PIPELINES",
"env": "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
"pr": "SYSTEM_PULLREQUEST_PULLREQUESTID"
"env": "TF_BUILD",
"pr": {
"BUILD_REASON": "PullRequest"
}
},
{
"name": "Bamboo",
Expand Down

0 comments on commit 5ea8d85

Please sign in to comment.