unexpected
Advanced tools
Comparing version 5.4.2 to 5.5.0
@@ -592,3 +592,3 @@ var utils = require('./utils'); | ||
}); | ||
if (this.flags.exhaustively) { | ||
if (type.is('arrayLike') || this.flags.exhaustively) { | ||
expect(subject, 'to only have keys', keys); | ||
@@ -632,3 +632,3 @@ } | ||
if (!(key in value)) { | ||
if (flags.exhaustively) { | ||
if (type.is('arrayLike') || flags.exhaustively) { | ||
annotation.error('should be removed'); | ||
@@ -670,7 +670,3 @@ } else { | ||
if (/^[a-z\$\_][a-z0-9\$\_]*$/i.test(key)) { | ||
this.key(key); | ||
} else { | ||
this.append(inspect(key)); | ||
} | ||
this.key(key); | ||
this.text(':').sp(); | ||
@@ -677,0 +673,0 @@ valueOutput.text(last ? '' : ','); |
@@ -12,3 +12,15 @@ module.exports = function (expect) { | ||
expect.output.addStyle('key', function (content) { | ||
this.text(content, '#666'); | ||
content = String(content); | ||
if (/^[a-z\$\_][a-z0-9\$\_]*$/i.test(content)) { | ||
this.text(content, '#666'); | ||
} else if (/^(?:0|[1-9][0-9]*)$/.test(content)) { | ||
this.number(content); | ||
} else { | ||
this.strings('\'') | ||
.strings(JSON.stringify(content).replace(/^"|"$/g, '') | ||
.replace(/'/g, "\\'") | ||
.replace(/\\"/g, '"')) | ||
.strings('\''); | ||
} | ||
}); | ||
@@ -15,0 +27,0 @@ expect.output.addStyle('number', function (content) { |
@@ -108,7 +108,3 @@ var utils = require('./utils'); | ||
} | ||
if (/^[a-z\$\_][a-z0-9\$\_]*$/i.test(key)) { | ||
propertyOutput.key(key); | ||
} else { | ||
propertyOutput.append(inspect(key, depth)); | ||
} | ||
propertyOutput.key(key); | ||
propertyOutput.text(':'); | ||
@@ -224,7 +220,3 @@ | ||
if (/^[a-z\$\_][a-z0-9\$\_]*$/i.test(key)) { | ||
this.key(key); | ||
} else { | ||
this.append(inspect(key)); | ||
} | ||
this.key(key); | ||
this.text(':').sp(); | ||
@@ -231,0 +223,0 @@ valueOutput.text(last ? '' : ','); |
{ | ||
"name": "unexpected", | ||
"version": "5.4.2", | ||
"version": "5.5.0", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -17,4 +17,5 @@ "keywords": [ | ||
"scripts": { | ||
"test": "make test", | ||
"travis": "make test && make test-phantomjs" | ||
"test": "make test && make test-phantomjs", | ||
"travis": "npm test", | ||
"prepublish": "npm test && make unexpected.js" | ||
}, | ||
@@ -21,0 +22,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3407908
11937