Skip to content

Commit

Permalink
chore: document hasOwnProperty Jest workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
cexbrayat committed Feb 13, 2022
1 parent f923e95 commit 88a5ced
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mount.ts
Expand Up @@ -507,7 +507,8 @@ export function mount(
console.warn = () => {}

const appRef = vm.$refs[MOUNT_COMPONENT_REF] as ComponentPublicInstance
// we add `hasOwnProperty` so jest can spy on the proxied vm without throwing
// we add `hasOwnProperty` so Jest can spy on the proxied vm without throwing
// note that this is not necessary with Jest v27+ or Vitest, but is kept for compatibility with older Jest versions
appRef.hasOwnProperty = (property) => {
return Reflect.has(appRef, property)
}
Expand Down

0 comments on commit 88a5ced

Please sign in to comment.