File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -231,21 +231,21 @@ const headersMatcher = (
231231 *
232232 * Jest and Jasmine support special matchers like `jasmine.objectContaining`, `expect.arrayContaining`, etc.
233233 *
234- * All these kind of objects have `sample` and `asymmetricMatch` function in __proto__
235- * `expect.objectContaining({ foo: 'bar })` -> `{ sample: { foo: 'bar' }, __proto__ : asymmetricMatch() {} }`
234+ * All these kind of objects have `sample` and `asymmetricMatch` function in their prototype
235+ * `expect.objectContaining({ foo: 'bar })` -> `{ sample: { foo: 'bar' }, [prototype] : asymmetricMatch() {} }`
236236 *
237237 * jasmine.any and jasmine.anything don't have `sample` property
238238 * @param filter
239239 */
240240const isMatcher = ( filter : unknown ) => {
241+ const proto = Object . getPrototypeOf ( filter )
241242 return (
242243 typeof filter === 'object' &&
243244 filter !== null &&
244- '__proto__' in filter &&
245- typeof filter . __proto__ === 'object' &&
246- filter . __proto__ &&
247- 'asymmetricMatch' in filter . __proto__ &&
248- typeof filter . __proto__ . asymmetricMatch === 'function'
245+ typeof proto === 'object' &&
246+ proto &&
247+ 'asymmetricMatch' in proto &&
248+ typeof proto . asymmetricMatch === 'function'
249249 )
250250}
251251
You can’t perform that action at this time.
0 commit comments