mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 05:37:20 +03: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;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -234,6 +234,8 @@ function checkSources(sources) {
|
||||
continue;
|
||||
if (name.startsWith('_'))
|
||||
continue;
|
||||
if (member.valueDeclaration && ts.getCombinedModifierFlags(member.valueDeclaration) & ts.ModifierFlags.Private)
|
||||
continue;
|
||||
if (EventEmitter.prototype.hasOwnProperty(name))
|
||||
continue;
|
||||
const memberType = checker.getTypeOfSymbolAtLocation(member, member.valueDeclaration);
|
||||
|
Loading…
Reference in New Issue
Block a user