mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(rpc): add a custom toJSON to help jest's expect library (#3489)
This commit is contained in:
parent
f983432536
commit
d516f81eeb
@ -106,6 +106,17 @@ export abstract class ChannelOwner<T extends Channel = Channel, Initializer = {}
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private toJSON() {
|
||||||
|
// Jest's expect library tries to print objects sometimes.
|
||||||
|
// RPC objects can contain links to lots of other objects,
|
||||||
|
// which can cause jest to crash. Let's help it out
|
||||||
|
// by just returning the important values.
|
||||||
|
return {
|
||||||
|
_type: this._type,
|
||||||
|
_guid: this._guid,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const debugLogger = new DebugLoggerSink();
|
const debugLogger = new DebugLoggerSink();
|
||||||
|
@ -234,6 +234,8 @@ function checkSources(sources) {
|
|||||||
continue;
|
continue;
|
||||||
if (name.startsWith('_'))
|
if (name.startsWith('_'))
|
||||||
continue;
|
continue;
|
||||||
|
if (member.valueDeclaration && ts.getCombinedModifierFlags(member.valueDeclaration) & ts.ModifierFlags.Private)
|
||||||
|
continue;
|
||||||
if (EventEmitter.prototype.hasOwnProperty(name))
|
if (EventEmitter.prototype.hasOwnProperty(name))
|
||||||
continue;
|
continue;
|
||||||
const memberType = checker.getTypeOfSymbolAtLocation(member, member.valueDeclaration);
|
const memberType = checker.getTypeOfSymbolAtLocation(member, member.valueDeclaration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user