Skip to content

Commit

Permalink
feat: only warn on missing config
Browse files Browse the repository at this point in the history
returns empty module in case of absent config
  • Loading branch information
Guria committed Jul 14, 2016
1 parent 2b15114 commit 2662952
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function Router (routesConfig, options) {
options = options || {}

if (!routesConfig) {
throw new Error('Cerebral router - Routes configuration wasn\'t provided.')
console.warn('Cerebral router - Routes configuration wasn\'t provided.')
return function () {}
} else {
routesConfig = flattenConfig(routesConfig)
}
Expand Down
5 changes: 3 additions & 2 deletions tests/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,12 @@ module.exports = {
test.done()
},

'should throw on missing routes': function (test) {
test.throws(function () {
'should warn on missing routes': function (test) {
test.doesNotThrow(function () {
Router()
})

test.equal(this.warnMessage.length >= 0, true)
test.done()
},

Expand Down

0 comments on commit 2662952

Please sign in to comment.