Include function names in pretty printer output
This helps make matcher errors and spy strategy mismatch errors easier to understand in cases where the difference involves expecting one function but getting a different one.
This commit is contained in:
@@ -35,7 +35,11 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
} else if (value instanceof RegExp) {
|
||||
this.emitScalar(value.toString());
|
||||
} else if (typeof value === 'function') {
|
||||
this.emitScalar('Function');
|
||||
if (value.name) {
|
||||
this.emitScalar(`Function '${value.name}'`);
|
||||
} else {
|
||||
this.emitScalar('Function');
|
||||
}
|
||||
} else if (j$.isDomNode(value)) {
|
||||
if (value.tagName) {
|
||||
this.emitDomElement(value);
|
||||
|
||||
Reference in New Issue
Block a user