diff --git a/index.js b/index.js index 180ad1f2..28431883 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,12 @@ -const {callbackify} = require('util'); const verifyGithub = require('./lib/verify'); -const publishGit = require('./lib/publish'); +const publishGithub = require('./lib/publish'); let verified; -async function verifyConditions(pluginConfig, {pkg, options: {publish}}) { +async function verifyConditions(pluginConfig, {options}) { // If the Github publish plugin is used and has `assets` configured, validate it now in order to prevent any release if the configuration is wrong - if (publish) { - const publishPlugin = (Array.isArray(publish) ? publish : [publish]).find( + if (options.publish) { + const publishPlugin = (Array.isArray(options.publish) ? options.publish : [options.publish]).find( config => config.path && config.path === '@semantic-release/github' ); if (publishPlugin && publishPlugin.assets) { @@ -15,16 +14,16 @@ async function verifyConditions(pluginConfig, {pkg, options: {publish}}) { } } - await verifyGithub(pluginConfig, pkg); + await verifyGithub(pluginConfig, options); verified = true; } -async function publish(pluginConfig, {pkg, nextRelease, options, logger}) { +async function publish(pluginConfig, {nextRelease, options, logger}) { if (!verified) { - await verifyGithub(pluginConfig, pkg); + await verifyGithub(pluginConfig, options); verified = true; } - await publishGit(pluginConfig, options, pkg, nextRelease, logger); + await publishGithub(pluginConfig, options, nextRelease, logger); } -module.exports = {verifyConditions: callbackify(verifyConditions), publish: callbackify(publish)}; +module.exports = {verifyConditions, publish}; diff --git a/lib/publish.js b/lib/publish.js index 493092b3..31878615 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -1,15 +1,15 @@ const {basename} = require('path'); const {parse} = require('url'); const {stat} = require('fs-extra'); -const gitUrlParse = require('git-url-parse'); +const parseGithubUrl = require('parse-github-url'); const GitHubApi = require('github'); const pEachSeries = require('p-each-series'); const debug = require('debug')('semantic-release:publish-github'); const resolveConfig = require('./resolve-config'); -module.exports = async (pluginConfig, {branch}, {repository}, {version, gitHead, gitTag, notes}, logger) => { +module.exports = async (pluginConfig, {branch, repositoryUrl}, {version, gitHead, gitTag, notes}, logger) => { const {githubToken, githubUrl, githubApiPathPrefix, assets} = resolveConfig(pluginConfig); - const {name: repo, owner} = gitUrlParse(repository.url); + const {name: repo, owner} = parseGithubUrl(repositoryUrl); let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; protocol = (protocol || '').split(':')[0] || null; diff --git a/lib/verify.js b/lib/verify.js index b284a822..0d04037e 100644 --- a/lib/verify.js +++ b/lib/verify.js @@ -1,20 +1,12 @@ const {parse} = require('url'); -const gitUrlParse = require('git-url-parse'); +const parseGithubUrl = require('parse-github-url'); const GitHubApi = require('github'); const SemanticReleaseError = require('@semantic-release/error'); const resolveConfig = require('./resolve-config'); -module.exports = async (pluginConfig, {name, repository}) => { +module.exports = async (pluginConfig, {repositoryUrl}) => { const {githubToken, githubUrl, githubApiPathPrefix, assets} = resolveConfig(pluginConfig); - if (!name) { - throw new SemanticReleaseError('No "name" found in package.json.', 'ENOPKGNAME'); - } - - if (!repository || !repository.url) { - throw new SemanticReleaseError('No "repository" found in package.json.', 'ENOPKGREPO'); - } - if (!githubToken) { throw new SemanticReleaseError('No github token specified.', 'ENOGHTOKEN'); } @@ -29,7 +21,14 @@ module.exports = async (pluginConfig, {name, repository}) => { } } - const {name: repo, owner} = gitUrlParse(repository.url); + const {name: repo, owner} = parseGithubUrl(repositoryUrl); + if (!owner || !repo) { + throw new SemanticReleaseError( + `The git repository URL ${repositoryUrl} is not a valid Github URL.`, + 'EINVALIDGITURL' + ); + } + let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; protocol = (protocol || '').split(':')[0] || null; diff --git a/package.json b/package.json index e2269fa3..23bf3380 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ "@semantic-release/error": "^2.1.0", "debug": "^3.1.0", "fs-extra": "^4.0.2", - "git-url-parse": "^7.0.1", "github": "^12.0.5", - "p-each-series": "^1.0.0" + "p-each-series": "^1.0.0", + "parse-github-url": "^1.0.1" }, "devDependencies": { "ava": "^0.23.0", @@ -34,7 +34,7 @@ "nock": "^9.1.0", "nyc": "^11.2.1", "prettier": "~1.8.2", - "semantic-release": "^9.1.1", + "semantic-release": "^10.0.0", "sinon": "^4.0.0", "xo": "^0.18.2" }, diff --git a/test/integration.test.js b/test/integration.test.js index 896f0910..5490560d 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -1,4 +1,3 @@ -import {promisify} from 'util'; import {escape} from 'querystring'; import test from 'ava'; import {stub, match} from 'sinon'; @@ -36,14 +35,13 @@ test.serial('Verify Github auth', async t => { process.env.GITHUB_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; - const options = {}; - const pkg = {name: 'package-name', repository: {url: `git+https://othertesturl.com/${owner}/${repo}.git`}}; + const options = {repositoryUrl: `git+https://othertesturl.com/${owner}/${repo}.git`}; const github = authenticate({githubToken: process.env.GITHUB_TOKEN}) .get(`/repos/${owner}/${repo}`) .reply(200, {permissions: {push: true}}); - await t.notThrows(promisify(t.context.m.verifyConditions)({}, {pkg, options})); + await t.notThrows(t.context.m.verifyConditions({}, {options})); t.true(github.isDone()); }); @@ -52,14 +50,16 @@ test.serial('Verify Github auth with publish options', async t => { process.env.GITHUB_TOKEN = 'github_token'; const owner = 'test_user'; const repo = 'test_repo'; - const options = {publish: {path: '@semantic-release/github'}}; - const pkg = {name: 'package-name', repository: {url: `git+https://othertesturl.com/${owner}/${repo}.git`}}; + const options = { + publish: {path: '@semantic-release/github'}, + repositoryUrl: `git+https://othertesturl.com/${owner}/${repo}.git`, + }; const github = authenticate({githubToken: process.env.GITHUB_TOKEN}) .get(`/repos/${owner}/${repo}`) .reply(200, {permissions: {push: true}}); - await t.notThrows(promisify(t.context.m.verifyConditions)({}, {pkg, options})); + await t.notThrows(t.context.m.verifyConditions({}, {options})); t.true(github.isDone()); }); @@ -69,14 +69,16 @@ test.serial('Verify Github auth and assets config', async t => { const owner = 'test_user'; const repo = 'test_repo'; const assets = [{path: 'lib/file.js'}, 'file.js']; - const options = {publish: [{path: '@semantic-release/npm'}, {path: '@semantic-release/github', assets}]}; - const pkg = {name: 'package-name', repository: {url: `git+https://othertesturl.com/${owner}/${repo}.git`}}; + const options = { + publish: [{path: '@semantic-release/npm'}, {path: '@semantic-release/github', assets}], + repositoryUrl: `git+https://othertesturl.com/${owner}/${repo}.git`, + }; const github = authenticate({githubToken: process.env.GH_TOKEN}) .get(`/repos/${owner}/${repo}`) .reply(200, {permissions: {push: true}}); - await t.notThrows(promisify(t.context.m.verifyConditions)({}, {pkg, options})); + await t.notThrows(t.context.m.verifyConditions({}, {options})); t.true(github.isDone()); }); @@ -86,10 +88,12 @@ test.serial('Throw SemanticReleaseError if invalid config', async t => { const owner = 'test_user'; const repo = 'test_repo'; const assets = [{wrongProperty: 'lib/file.js'}]; - const options = {publish: [{path: '@semantic-release/npm'}, {path: '@semantic-release/github', assets}]}; - const pkg = {name: 'package-name', repository: {url: `git+https://othertesturl.com/${owner}/${repo}.git`}}; + const options = { + publish: [{path: '@semantic-release/npm'}, {path: '@semantic-release/github', assets}], + repositoryUrl: `git+https://othertesturl.com/${owner}/${repo}.git`, + }; - const error = await t.throws(promisify(t.context.m.verifyConditions)({}, {pkg, options})); + const error = await t.throws(t.context.m.verifyConditions({}, {options})); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'EINVALIDASSETS'); @@ -104,8 +108,7 @@ test.serial('Publish a release with an array of assets', async t => { {path: 'test/fixtures/upload_other.txt', name: 'other_file.txt', label: 'Other File'}, ]; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {name: 'package-name', repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const assetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/upload.txt`; const otherAssetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/other_file.txt`; @@ -134,7 +137,7 @@ test.serial('Publish a release with an array of assets', async t => { ) .reply(200, {browser_download_url: otherAssetUrl}); - await promisify(t.context.m.publish)({githubToken, assets}, {pkg, nextRelease, options, logger: t.context.logger}); + await t.context.m.publish({githubToken, assets}, {nextRelease, options, logger: t.context.logger}); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.log.calledWith(match.string, assetUrl)); @@ -151,10 +154,10 @@ test.serial('Verify Github auth and release', async t => { 'test/fixtures/upload.txt', {path: 'test/fixtures/upload_other.txt', name: 'other_file.txt', label: 'Other File'}, ]; - const pkg = {name: 'package-name', repository: {url: `https://github.com/${owner}/${repo}.git`}}; const options = { publish: [{path: '@semantic-release/npm'}, {path: '@semantic-release/github', assets}], branch: 'master', + repositoryUrl: `https://github.com/${owner}/${repo}.git`, }; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; @@ -185,8 +188,8 @@ test.serial('Verify Github auth and release', async t => { ) .reply(200, {browser_download_url: otherAssetUrl}); - await t.notThrows(promisify(t.context.m.verifyConditions)({}, {pkg, options})); - await promisify(t.context.m.publish)({assets}, {pkg, nextRelease, options, logger: t.context.logger}); + await t.notThrows(t.context.m.verifyConditions({}, {options})); + await t.context.m.publish({assets}, {nextRelease, options, logger: t.context.logger}); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.log.calledWith(match.string, assetUrl)); diff --git a/test/publish.test.js b/test/publish.test.js index c5ca8012..a987cff7 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -36,8 +36,7 @@ test.serial('Publish a release', async t => { const githubToken = 'github_token'; const pluginConfig = {githubToken}; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const github = authenticate({githubToken}) @@ -51,7 +50,7 @@ test.serial('Publish a release', async t => { .post(`/repos/${owner}/${repo}/git/refs`, {ref: `refs/tags/${nextRelease.gitTag}`, sha: nextRelease.gitHead}) .reply({}); - await publish(pluginConfig, options, pkg, nextRelease, t.context.logger); + await publish(pluginConfig, options, nextRelease, t.context.logger); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(github.isDone()); @@ -65,8 +64,7 @@ test.serial('Publish a release with one asset', async t => { process.env.GH_PREFIX = 'prefix'; const pluginConfig = {assets: 'test/fixtures/upload.txt'}; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const assetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/upload.txt`; const releaseId = 1; @@ -90,7 +88,7 @@ test.serial('Publish a release with one asset', async t => { .post(`/repos/${owner}/${repo}/releases/${releaseId}/assets?name=${escape('upload.txt')}`) .reply(200, {browser_download_url: assetUrl}); - await publish(pluginConfig, options, pkg, nextRelease, t.context.logger); + await publish(pluginConfig, options, nextRelease, t.context.logger); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.log.calledWith(match.string, assetUrl)); @@ -107,8 +105,7 @@ test.serial('Publish a release with one asset and custom github url', async t => const assets = 'test/fixtures/upload.txt'; const pluginConfig = {githubUrl: process.env.GITHUB_URL, githubApiPathPrefix: process.env.GITHUB_PREFIX, assets}; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const assetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/upload.txt`; const releaseId = 1; @@ -132,7 +129,7 @@ test.serial('Publish a release with one asset and custom github url', async t => .post(`/repos/${owner}/${repo}/releases/${releaseId}/assets?name=${escape('upload.txt')}`) .reply(200, {browser_download_url: assetUrl}); - await publish(pluginConfig, options, pkg, nextRelease, t.context.logger); + await publish(pluginConfig, options, nextRelease, t.context.logger); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.log.calledWith(match.string, assetUrl)); @@ -152,8 +149,7 @@ test.serial('Publish a release with an array of assets', async t => { ], }; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const assetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/upload.txt`; const otherAssetUrl = `https://github.com/${owner}/${repo}/releases/download/${nextRelease.version}/other_file.txt`; @@ -180,7 +176,7 @@ test.serial('Publish a release with an array of assets', async t => { ) .reply(200, {browser_download_url: otherAssetUrl}); - await publish(pluginConfig, options, pkg, nextRelease, t.context.logger); + await publish(pluginConfig, options, nextRelease, t.context.logger); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.log.calledWith(match.string, assetUrl)); @@ -198,8 +194,7 @@ test.serial('Publish a release with an array of misconfigured assets', async t = assets: ['test/fixtures', {path: 'test/fixtures/missing.txt', name: 'missing.txt', label: 'Missing File'}], }; const nextRelease = {version: '1.0.0', gitHead: '123', gitTag: 'v1.0.0', notes: 'Test release note body'}; - const options = {branch: 'master'}; - const pkg = {repository: {url: `https://github.com/${owner}/${repo}.git`}}; + const options = {branch: 'master', repositoryUrl: `https://github.com/${owner}/${repo}.git`}; const releaseUrl = `https://github.com/${owner}/${repo}/releases/${nextRelease.version}`; const releaseId = 1; @@ -214,7 +209,7 @@ test.serial('Publish a release with an array of misconfigured assets', async t = .post(`/repos/${owner}/${repo}/git/refs`, {ref: `refs/tags/${nextRelease.gitTag}`, sha: nextRelease.gitHead}) .reply({}); - await publish(pluginConfig, options, pkg, nextRelease, t.context.logger); + await publish(pluginConfig, options, nextRelease, t.context.logger); t.true(t.context.log.calledWith(match.string, releaseUrl)); t.true(t.context.error.calledWith(match.string, 'test/fixtures/missing.txt')); diff --git a/test/verify.test.js b/test/verify.test.js index 48129b8c..afadf36d 100644 --- a/test/verify.test.js +++ b/test/verify.test.js @@ -34,10 +34,7 @@ test.serial('Verify package, token and repository access', async t => { .reply(200, {permissions: {push: true}}); await t.notThrows( - verify( - {githubToken, assets}, - {name: 'package-name', repository: {url: `git+https://othertesturl.com/${owner}/${repo}.git`}} - ) + verify({githubToken, assets}, {repositoryUrl: `git+https://othertesturl.com/${owner}/${repo}.git`}) ); t.true(github.isDone()); }); @@ -54,10 +51,7 @@ test.serial('Verify package, token and repository access and custom URL', async .reply(200, {permissions: {push: true}}); await t.notThrows( - verify( - {githubUrl, githubToken, githubApiPathPrefix}, - {name: 'package-name', repository: {url: `git@othertesturl.com:${owner}/${repo}.git`}} - ) + verify({githubUrl, githubToken, githubApiPathPrefix}, {repositoryUrl: `git@othertesturl.com:${owner}/${repo}.git`}) ); t.true(github.isDone()); }); @@ -80,7 +74,7 @@ test.serial('Verify package, token and repository with environment varialbes', a await t.notThrows( verify( {githubUrl: process.env.GH_URL, githubApiPathPrefix: process.env.GH_PREFIX}, - {name: 'package-name', repository: {url: `git@othertesturl.com:${owner}/${repo}.git`}} + {repositoryUrl: `git@othertesturl.com:${owner}/${repo}.git`} ) ); t.true(github.isDone()); @@ -104,41 +98,17 @@ test.serial('Verify package, token and repository access with alternative enviro await t.notThrows( verify( {githubUrl: process.env.GITHUB_URL, githubApiPathPrefix: process.env.GITHUB_PREFIX}, - {name: 'package-name', repository: {url: `git@othertesturl.com:${owner}/${repo}.git`}} + {repositoryUrl: `git@othertesturl.com:${owner}/${repo}.git`} ) ); t.true(github.isDone()); }); -test.serial('Throw SemanticReleaseError for missing package name', async t => { - const error = await t.throws(verify({}, {repository: {url: 'http://github.com/whats/up.git'}})); - - t.true(error instanceof SemanticReleaseError); - t.is(error.code, 'ENOPKGNAME'); -}); - -test.serial('Throw SemanticReleaseError for missing repository', async t => { - const error = await t.throws(verify({}, {name: 'package'})); - - t.true(error instanceof SemanticReleaseError); - t.is(error.code, 'ENOPKGREPO'); -}); - -test.serial('Throw SemanticReleaseError for missing repository url', async t => { - const error = await t.throws(verify({}, {name: 'package', repository: {}})); - - t.true(error instanceof SemanticReleaseError); - t.is(error.code, 'ENOPKGREPO'); -}); - test.serial('Throw SemanticReleaseError if "assets" option is not a string or an array of objects', async t => { const githubToken = 'github_token'; const assets = 42; const error = await t.throws( - verify( - {githubToken, assets}, - {name: 'package', repository: {url: 'https://github.com/semantic-release/github.git'}} - ) + verify({githubToken, assets}, {repositoryUrl: 'https://github.com/semantic-release/github.git'}) ); t.true(error instanceof SemanticReleaseError); @@ -149,10 +119,7 @@ test.serial('Throw SemanticReleaseError if "assets" option is an Array with inva const githubToken = 'github_token'; const assets = ['file.js', 42]; const error = await t.throws( - verify( - {githubToken, assets}, - {name: 'package', repository: {url: 'https://github.com/semantic-release/github.git'}} - ) + verify({githubToken, assets}, {repositoryUrl: 'https://github.com/semantic-release/github.git'}) ); t.true(error instanceof SemanticReleaseError); @@ -163,10 +130,7 @@ test.serial('Throw SemanticReleaseError if "assets" option is an Object missing const githubToken = 'github_token'; const assets = {name: 'file.js'}; const error = await t.throws( - verify( - {githubToken, assets}, - {name: 'package', repository: {url: 'https://github.com/semantic-release/github.git'}} - ) + verify({githubToken, assets}, {repositoryUrl: 'https://github.com/semantic-release/github.git'}) ); t.true(error instanceof SemanticReleaseError); @@ -178,12 +142,7 @@ test.serial( async t => { const githubToken = 'github_token'; const assets = [{path: 'lib/file.js'}, {name: 'file.js'}]; - const error = await t.throws( - verify( - {githubToken, assets}, - {name: 'package', repository: {url: 'https://github.com/semantic-release/github.git'}} - ) - ); + const error = await t.throws(verify({githubToken, assets}, 'https://github.com/semantic-release/github.git')); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'EINVALIDASSETS'); @@ -191,9 +150,7 @@ test.serial( ); test.serial('Throw SemanticReleaseError for missing github token', async t => { - const error = await t.throws( - verify({}, {name: 'package', repository: {url: 'https://github.com/semantic-release/github.git'}}) - ); + const error = await t.throws(verify({}, {repositoryUrl: 'https://github.com/semantic-release/github.git'})); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'ENOGHTOKEN'); @@ -208,15 +165,22 @@ test.serial('Throw SemanticReleaseError for invalid token', async t => { .get(`/repos/${owner}/${repo}`) .reply(401); - const error = await t.throws( - verify({githubToken}, {name: 'package-name', repository: {url: `https://github.com:${owner}/${repo}.git`}}) - ); + const error = await t.throws(verify({githubToken}, {repositoryUrl: `https://github.com:${owner}/${repo}.git`})); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'EINVALIDGHTOKEN'); t.true(github.isDone()); }); +test.serial('Throw SemanticReleaseError for invalid repositoryUrl', async t => { + const githubToken = 'github_token'; + + const error = await t.throws(verify({githubToken}, {repositoryUrl: 'invalid_url'})); + + t.true(error instanceof SemanticReleaseError); + t.is(error.code, 'EINVALIDGITURL'); +}); + test.serial("Throw SemanticReleaseError if token doesn't have the push permission on the repository", async t => { const owner = 'test_user'; const repo = 'test_repo'; @@ -226,9 +190,7 @@ test.serial("Throw SemanticReleaseError if token doesn't have the push permissio .get(`/repos/${owner}/${repo}`) .reply(200, {permissions: {push: false}}); - const error = await t.throws( - verify({githubToken}, {name: 'package-name', repository: {url: `https://github.com:${owner}/${repo}.git`}}) - ); + const error = await t.throws(verify({githubToken}, {repositoryUrl: `https://github.com:${owner}/${repo}.git`})); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'EGHNOPERMISSION'); @@ -244,9 +206,7 @@ test.serial("Throw SemanticReleaseError if the repository doesn't exist", async .get(`/repos/${owner}/${repo}`) .reply(404); - const error = await t.throws( - verify({githubToken}, {name: 'package-name', repository: {url: `https://github.com:${owner}/${repo}.git`}}) - ); + const error = await t.throws(verify({githubToken}, {repositoryUrl: `https://github.com:${owner}/${repo}.git`})); t.true(error instanceof SemanticReleaseError); t.is(error.code, 'EMISSINGREPO'); @@ -262,9 +222,7 @@ test.serial('Throw error if github return any other errors', async t => { .get(`/repos/${owner}/${repo}`) .reply(500); - const error = await t.throws( - verify({githubToken}, {name: 'package-name', repository: {url: `https://github.com:${owner}/${repo}.git`}}) - ); + const error = await t.throws(verify({githubToken}, {repositoryUrl: `https://github.com:${owner}/${repo}.git`})); t.is(error.code, 500); t.true(github.isDone());