Skip to content

Commit c4f0f55

Browse files
committed
Update pretty-format to remove the need for the Array workaround! 🎉
1 parent b83521a commit c4f0f55

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"sinon-chai": "^2.8.0"
5353
},
5454
"dependencies": {
55-
"pretty-format": "^3.5.0"
55+
"pretty-format": "^3.5.1"
5656
}
5757
}

src/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,10 @@ function getNodeProps(vnode) {
9393
// we have to patch in Array support, Possible issue in npm.im/pretty-format
9494
let preactPlugin = {
9595
test(object) {
96-
if (Array.isArray(object)) {
97-
return preactPlugin.test(object[0]);
98-
}
9996
// return object && Object.prototype.toString.call(object)==='[object VNode]';
100-
return object && typeof object==='object' && 'nodeName' in object && 'attributes' in object && 'children' in object;
97+
return object && typeof object==='object' && 'nodeName' in object && 'attributes' in object && 'children' in object && !('nodeType' in object);
10198
},
10299
print(val, print, indent) {
103-
if (Array.isArray(val)) {
104-
return 'Array [\n ' + val.map( v => preactPlugin.test(v) ? renderToString(v, preactPlugin.context, preactPlugin.opts, true) : v ).join(',\n ') + '\n]';
105-
}
106100
return renderToString(val, preactPlugin.context, preactPlugin.opts, true);
107101
}
108102
};

0 commit comments

Comments
 (0)