style: branch available in options not root of config
This commit is contained in:
parent
5cc7da6035
commit
a16c36ed4d
@ -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'
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user