diff --git a/package.json b/package.json index 0c0821e..45661f3 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "js-yaml": "^3.11.0", - "probot": "git+https://github.com/jnewland/probot#46a5c9a8741716640d9e275d193d53ac2de89320", + "probot": "^7.3.1", "raven": "^2.6.2" }, "devDependencies": { diff --git a/test/index.test.js b/test/index.test.js index 0604d71..3bc4850 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1,14 +1,14 @@ -const { createRobot } = require('probot') -const app = require('..') +const { Application } = require('probot') +const Yamburger = require('..') const HttpError = require('@octokit/rest/lib/request/http-error') describe('yamburger', () => { - let robot + let app let github beforeEach(() => { - robot = createRobot() - app(robot) + app = new Application() + app.load(Yamburger) }) describe('check suite requests', () => { @@ -24,12 +24,12 @@ describe('yamburger', () => { } } - robot.auth = () => Promise.resolve(github) + app.auth = () => Promise.resolve(github) }) it('ignores check requests not associated with a PR', async () => { const payload = require('./payloads/check_suite/requested/no_pulls.json') - await robot.receive({ event: 'check_suite', payload }) + await app.receive({ event: 'check_suite', payload }) expect(github.checks.create).toHaveBeenCalled() expect(github.checks.create.mock.calls[0][0].conclusion).toBe('neutral') }) @@ -67,12 +67,12 @@ describe('yamburger', () => { } } - robot.auth = () => Promise.resolve(github) + app.auth = () => Promise.resolve(github) }) it('kicks off a check when PRs are opened', async () => { const payload = require('./payloads/pull_request/opened.json') - await robot.receive({ event: 'pull_request', payload }) + await app.receive({ event: 'pull_request', payload }) expect(github.checks.create).toHaveBeenCalled() expect(github.checks.create.mock.calls[0][0].status).toBe('in_progress') expect(github.pullRequests.getFiles).toHaveBeenCalled() @@ -114,12 +114,12 @@ describe('yamburger', () => { } } - robot.auth = () => Promise.resolve(github) + app.auth = () => Promise.resolve(github) }) it('kicks off a check when PRs are opened', async () => { const payload = require('./payloads/pull_request/opened.json') - await robot.receive({ event: 'pull_request', payload }) + await app.receive({ event: 'pull_request', payload }) expect(github.checks.create).toHaveBeenCalled() expect(github.checks.create.mock.calls[0][0].status).toBe('in_progress') expect(github.pullRequests.getFiles).toHaveBeenCalled() @@ -163,12 +163,12 @@ describe('yamburger', () => { } } - robot.auth = () => Promise.resolve(github) + app.auth = () => Promise.resolve(github) }) it('kicks off a check when PRs are opened', async () => { const payload = require('./payloads/pull_request/opened.json') - await robot.receive({ event: 'pull_request', payload }) + await app.receive({ event: 'pull_request', payload }) expect(github.checks.create).toHaveBeenCalled() expect(github.checks.create.mock.calls[0][0].status).toBe('in_progress') expect(github.pullRequests.getFiles).toHaveBeenCalled() diff --git a/yarn.lock b/yarn.lock index 9d09ce7..7b08b91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,9 +2,9 @@ # yarn lockfile v1 -"@octokit/rest@git+https://github.com/jnewland/rest.js.git#e018745dd73777f469b8a09ab38fd60a1af78a83": - version "0.0.0-semantically-released" - resolved "git+https://github.com/jnewland/rest.js.git#e018745dd73777f469b8a09ab38fd60a1af78a83" +"@octokit/rest@^15.13.1": + version "15.15.1" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.15.1.tgz#7863f50f7c5753211ea3e29e10b84c93159e9e37" dependencies: before-after-hook "^1.1.0" btoa-lite "^1.0.0" @@ -13,14 +13,19 @@ https-proxy-agent "^2.2.0" lodash "^4.17.4" node-fetch "^2.1.1" + universal-user-agent "^2.0.0" url-template "^2.0.8" -"@octokit/webhooks@^3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-3.1.1.tgz#589830d3a51489b6d689094f5355b570c142c086" +"@octokit/webhooks@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-5.0.2.tgz#fbf31398f0d235199591cef3c4a8fef7073c6073" dependencies: buffer-equal-constant-time "^1.0.1" - debug "^3.1.0" + debug "^4.0.0" + +"@types/supports-color@^5.3.0": + version "5.3.0" + resolved "http://registry.npmjs.org/@types/supports-color/-/supports-color-5.3.0.tgz#eb6a52e9531fb3ebcd401cec774d1bdfb571f793" abab@^1.0.3: version "1.0.4" @@ -456,9 +461,9 @@ body-parser@1.18.2: raw-body "2.3.2" type-is "~1.6.15" -bottleneck@^2.2.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.3.1.tgz#16292092ff040ccbf2d05d0a09d69eab7b1c46bc" +bottleneck@^2.8.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.12.1.tgz#7269626c9ab2ce1b206a2fcafe7434b44a1218fc" brace-expansion@^1.1.7: version "1.1.11" @@ -715,10 +720,14 @@ combined-stream@1.0.6, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.11.0, commander@^2.12.2: +commander@^2.12.2: version "2.15.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" +commander@^2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + compare-versions@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.2.1.tgz#a49eb7689d4caaf0b6db5220173fd279614000f7" @@ -838,6 +847,12 @@ debug@3.1.0, debug@^3.1.0: dependencies: ms "2.0.0" +debug@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" + dependencies: + ms "^2.1.1" + decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -956,9 +971,9 @@ doctrine@^2.0.0, doctrine@^2.1.0: dependencies: esutils "^2.0.2" -dotenv@~5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef" +dotenv@~6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.1.0.tgz#9853b6ca98292acb7dec67a95018fa40bccff42c" dtrace-provider@~0.8: version "0.8.6" @@ -1376,9 +1391,9 @@ expect@^21.2.1: jest-message-util "^21.2.1" jest-regex-util "^21.2.0" -express-async-errors@^2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/express-async-errors/-/express-async-errors-2.1.2.tgz#a5692a0763904109f27d9649b4f827cf89100f53" +express-async-errors@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/express-async-errors/-/express-async-errors-3.1.1.tgz#6053236d61d21ddef4892d6bd1d736889fc9da41" express@^4.16.2: version "4.16.3" @@ -2012,6 +2027,10 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-base64@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/is-base64/-/is-base64-0.0.5.tgz#39ecd12e937c667edd3b17fa677036825483b477" + is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -2799,6 +2818,10 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" +macos-release@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-1.1.0.tgz#831945e29365b470aa8724b0ab36c8f8959d10fb" + makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" @@ -3236,6 +3259,13 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" +os-name@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/os-name/-/os-name-2.0.1.tgz#b9a386361c17ae3a21736ef0599405c9a8c5dc5e" + dependencies: + macos-release "^1.0.0" + win-release "^1.0.0" + os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -3429,29 +3459,35 @@ private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" -"probot@git+https://github.com/jnewland/probot#8ff179b70ec6cb4762cda9c3e15217ea29645b1b": - version "0.0.0-development" - resolved "git+https://github.com/jnewland/probot#8ff179b70ec6cb4762cda9c3e15217ea29645b1b" +probot@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/probot/-/probot-7.3.1.tgz#c18da943eb143d58857bbfc7842f98ef5b4585d4" dependencies: - "@octokit/rest" "git+https://github.com/jnewland/rest.js.git#e018745dd73777f469b8a09ab38fd60a1af78a83" - "@octokit/webhooks" "^3.1.1" - bottleneck "^2.2.0" + "@octokit/rest" "^15.13.1" + "@octokit/webhooks" "^5.0.2" + "@types/supports-color" "^5.3.0" + bottleneck "^2.8.0" bunyan "^1.8.12" bunyan-format "^0.2.1" bunyan-sentry-stream "^1.1.0" cache-manager "^2.4.0" - commander "^2.11.0" - dotenv "~5.0.0" + commander "^2.19.0" + dotenv "~6.1.0" express "^4.16.2" - express-async-errors "^2.1.0" + express-async-errors "^3.0.0" hbs "^4.0.1" + is-base64 "0.0.5" js-yaml "^3.9.1" jsonwebtoken "^8.1.0" pkg-conf "^2.0.0" promise-events "^0.1.3" + qs "^6.5.2" raven "^2.4.2" resolve "^1.4.0" semver "^5.5.0" + supports-color "^5.5.0" + update-dotenv "^1.1.0" + uuid "^3.2.1" process-nextick-args@~2.0.0: version "2.0.0" @@ -3492,7 +3528,7 @@ qs@6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" -qs@^6.5.1, qs@~6.5.1: +qs@^6.5.1, qs@^6.5.2, qs@~6.5.1: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -3816,6 +3852,10 @@ semver@5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" +semver@^5.0.1: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + send@0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" @@ -4160,6 +4200,12 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +supports-color@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + dependencies: + has-flag "^3.0.0" + symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" @@ -4327,6 +4373,12 @@ uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" +universal-user-agent@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.0.1.tgz#18e591ca52b1cb804f6b9cbc4c336cf8191f80e1" + dependencies: + os-name "^2.0.1" + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -4338,6 +4390,10 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +update-dotenv@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-dotenv/-/update-dotenv-1.1.0.tgz#1b5cd677ce42148fc8c8ed299e064fefd99ea57b" + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -4381,6 +4437,10 @@ uuid@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" +uuid@^3.2.1: + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + validate-npm-package-license@^3.0.1: version "3.0.3" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" @@ -4456,6 +4516,12 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2" +win-release@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/win-release/-/win-release-1.1.1.tgz#5fa55e02be7ca934edfc12665632e849b72e5209" + dependencies: + semver "^5.0.1" + window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"