fix proxying expect.not

This commit is contained in:
Mathias Leppich 2024-09-21 00:31:39 +02:00
parent 978cd7d80a
commit 4d44faf911

View file

@ -184,13 +184,13 @@ function createExpect(info: ExpectMetaInfo, prefix: string[], customMatchers: Re
}
if (property === 'not') {
return new Proxy(expectLibrary, {
return new Proxy(expectLibrary.not, {
get: function(target: any, property: string) {
if (typeof property === 'string' && typeof customMatchers[property] === 'function' && typeof (customMatchers[property] as any).qualifiedName === 'string') {
const qualifiedName = (customMatchers[property] as any).qualifiedName as string;
return (expectLibrary as any)['not'][qualifiedName];
return target[qualifiedName];
}
return (expectLibrary as any)['not'][property];
return target[property];
},
});
}