diff --git a/src/pretty-format.js b/src/pretty-format.js index fa3d6dc..d255a8a 100755 --- a/src/pretty-format.js +++ b/src/pretty-format.js @@ -279,10 +279,10 @@ Type.Number = new Type({ * @memberOf Type */ Type.Object = new Type({ - test: _.isPlainObject, + test: _.isObject, print(val) { - var result = 'Object {', + var result = val.constructor.name + ' {', keys = _.keys(val), symbols = getSymbols(val); @@ -420,11 +420,12 @@ Type.all = [ Type.NaN, Type.Null, Type.Number, - Type.Object, Type.RegExp, Type.Set, Type.String, Type.Symbol, Type.Undefined, - Type.Date + Type.Date, + + Type.Object ]; diff --git a/test/unit/types.js b/test/unit/types.js index 8d69893..29b4700 100755 --- a/test/unit/types.js +++ b/test/unit/types.js @@ -222,14 +222,19 @@ describe('Type', function() { }()); (function() { + function Foo() {} + var foo = new Foo(); + typeTests('Object', Type.Object, { test: [ { value: {}, pass: true }, - { value: new Map(), pass: false }, - { value: [], pass: false } + { value: foo, pass: true }, + { value: new Map(), pass: true }, + { value: [], pass: true } ], print: [ { input: {}, output: 'Object {}' }, + { input: foo, output: 'Foo {}' }, { input: { foo: 'bar', bar: 'baz' }, output: 'Object {\n "foo": "bar",\n "bar": "baz"\n}' }, { input: { foo: { bar: 'baz' } }, output: 'Object {\n "foo": Object {\n "bar": "baz"\n }\n}' }, { input: { [Symbol('foo')]: 'foo' }, output: 'Object {\n Symbol(foo): "foo"\n}' }