From a16c36ed4d9fb1a10b84069f9239e63bb4605d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6nnemann?= Date: Sat, 22 Aug 2015 19:49:09 +0200 Subject: [PATCH] style: branch available in options not root of config --- src/lib/commits.js | 3 ++- test/specs/commits.js | 6 +++--- test/specs/pre.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/commits.js b/src/lib/commits.js index d25c1c97..ae5a6fe0 100644 --- a/src/lib/commits.js +++ b/src/lib/commits.js @@ -4,7 +4,8 @@ const log = require('npmlog') const SemanticReleaseError = require('@semantic-release/error') -module.exports = function ({lastRelease, branch}, cb) { +module.exports = function ({lastRelease, options}, cb) { + const branch = options.branch const from = lastRelease.gitHead const range = (from ? from + '..' : '') + 'HEAD' diff --git a/test/specs/commits.js b/test/specs/commits.js index 71bbc5d0..2daae461 100644 --- a/test/specs/commits.js +++ b/test/specs/commits.js @@ -7,7 +7,7 @@ const commits = proxyquire('../../dist/lib/commits', { test('commits since last release', (t) => { t.test('get all commits', (tt) => { - commits({lastRelease: {}, branch: 'master'}, (err, commits) => { + commits({lastRelease: {}, options: {branch: 'master'}}, (err, commits) => { tt.error(err) tt.is(commits.length, 2, 'all commits') tt.is(commits[0].hash, 'hash-one', 'parsed hash') @@ -18,7 +18,7 @@ test('commits since last release', (t) => { }) t.test('get commits since hash', (tt) => { - commits({lastRelease: {gitHead: 'hash'}, branch: 'master'}, (err, commits) => { + commits({lastRelease: {gitHead: 'hash'}, options: {branch: 'master'}}, (err, commits) => { tt.error(err) tt.is(commits.length, 1, 'specified commits') tt.is(commits[0].hash, 'hash-one', 'parsed hash') @@ -29,7 +29,7 @@ test('commits since last release', (t) => { }) t.test('get commits since hash', (tt) => { - commits({lastRelease: {gitHead: 'notinhistory'}, branch: 'notmaster'}, (err, commits) => { + commits({lastRelease: {gitHead: 'notinhistory'}, options: {branch: 'notmaster'}}, (err, commits) => { tt.ok(err) tt.is(err.code, 'ENOTINHISTORY') tt.end() diff --git a/test/specs/pre.js b/test/specs/pre.js index 830cb0a6..6a140e05 100644 --- a/test/specs/pre.js +++ b/test/specs/pre.js @@ -30,7 +30,7 @@ test('full pre run', (t) => { tt.plan(3) pre({ - branch: 'master', + options: {branch: 'master'}, npm, pkg: {name: 'available'}, plugins @@ -45,7 +45,7 @@ test('full pre run', (t) => { tt.plan(3) pre({ - branch: 'master', + options: {branch: 'master'}, npm, pkg: {name: 'unavailable'}, plugins