Skip to content

Commit

Permalink
property assertion should only accept strings if nested, fixes chaijs…
Browse files Browse the repository at this point in the history
  • Loading branch information
solodynamo committed Sep 9, 2017
1 parent dbeae08 commit e167009
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/chai/core/assertions.js
Expand Up @@ -1765,6 +1765,12 @@ module.exports = function (chai, _) {
, obj = flag(this, 'object')
, ssfi = flag(this, 'ssfi');

if (typeof name !== 'string' && isNested) {
var msgPrefix = flag(this, 'message')
msgPrefix = msgPrefix ? msgPrefix + ': ' : ''
throw new AssertionError(msgPrefix + 'the argument to `property` must be a string')
}

if (isNested && isOwn) {
flagMsg = flagMsg ? flagMsg + ': ' : '';
throw new AssertionError(
Expand Down

0 comments on commit e167009

Please sign in to comment.