mirror of
https://github.com/chaijs/chai
synced 2024-11-15 00:07:11 +00:00
Show inherited properties when inspecting an object.
This commit is contained in:
parent
fe45a2d667
commit
730a12baa6
3 changed files with 7 additions and 5 deletions
|
@ -2,6 +2,8 @@
|
|||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
||||
|
||||
var getName = require('./getName');
|
||||
var getProperties = require('./getProperties');
|
||||
var getEnumerableProperties = require('./getEnumerableProperties');
|
||||
|
||||
module.exports = inspect;
|
||||
|
||||
|
@ -78,8 +80,8 @@ function formatValue(ctx, value, recurseTimes) {
|
|||
}
|
||||
|
||||
// Look up the keys of the object.
|
||||
var visibleKeys = Object.keys(value);
|
||||
var keys = ctx.showHidden ? Object.getOwnPropertyNames(value) : visibleKeys;
|
||||
var visibleKeys = getEnumerableProperties(value);
|
||||
var keys = ctx.showHidden ? getProperties(value) : visibleKeys;
|
||||
|
||||
// Some type of object without properties can be shortcutted.
|
||||
// In IE, errors have a single `stack` property, or if they are vanilla `Error`,
|
||||
|
|
|
@ -336,7 +336,7 @@ suite('expect', function () {
|
|||
|
||||
err(function(){
|
||||
expect(new FakeArgs).not.to.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
}, "expected { length: 0 } not to be empty");
|
||||
|
||||
err(function(){
|
||||
expect({arguments: 0}).to.be.empty;
|
||||
|
|
|
@ -320,7 +320,7 @@ suite('should', function() {
|
|||
|
||||
err(function(){
|
||||
(new FakeArgs).should.not.be.empty;
|
||||
}, "expected {} not to be empty");
|
||||
}, "expected { length: 0 } not to be empty");
|
||||
|
||||
err(function(){
|
||||
({arguments: 0}).should.be.empty;
|
||||
|
|
Loading…
Reference in a new issue