Skip to content
This repository has been archived by the owner on Dec 12, 2017. It is now read-only.

Commit

Permalink
fix load package bug
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed May 6, 2016
1 parent f29bca6 commit 0ade2bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions test/loadpackage.test.js
@@ -0,0 +1,14 @@
import test from 'ava'
import loadPackage from '../util/load-package'

test('load package fail', t => {
process.env.NODE_ENV = 'testing'

t.is(loadPackage(), undefined)
t.throws(function () {
loadPackage({})
})
t.throws(function () {
loadPackage(123)
})
})
2 changes: 1 addition & 1 deletion util/load-package.js
Expand Up @@ -16,7 +16,7 @@ module.exports = function (pkg) {
return
}

if (!isString || !isArray) {
if (!isString(pkg) && !isArray(pkg)) {
logger.fatal('use 字段只接受数组和字符串类型')
}

Expand Down

0 comments on commit 0ade2bd

Please sign in to comment.