Skip to content

Commit

Permalink
fix: remove hasOwnProperty workaround
Browse files Browse the repository at this point in the history
vue-test-utils-next now uses jest v27.1+, which includes a fix for hasOwnPropery (see jestjs/jest#11721).
This allows to remove the dirty workaround we had in our codebase, but users will have to update to Jest v27.1+.
  • Loading branch information
cexbrayat committed Aug 30, 2021
1 parent 226d3f1 commit c9b82b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -50,7 +50,13 @@
"vuex": "^4.0.2"
},
"peerDependencies": {
"vue": "^3.0.1"
"vue": "^3.0.1",
"jest": "^27.1.0"
},
"peerDependenciesMeta": {
"jest": {
"optional": true
}
},
"author": {
"name": "Lachlan Miller",
Expand Down
4 changes: 0 additions & 4 deletions src/mount.ts
Expand Up @@ -464,10 +464,6 @@ export function mount(
// if not, use the return value from app.mount.
const appRef = vm.$refs[MOUNT_COMPONENT_REF] as ComponentPublicInstance
const $vm = Reflect.ownKeys(appRef).length ? appRef : vm
// we add `hasOwnProperty` so jest can spy on the proxied vm without throwing
$vm.hasOwnProperty = (property) => {
return Reflect.has($vm, property)
}
console.warn = warnSave
return createWrapper(app, $vm, setProps)
}
Expand Down

0 comments on commit c9b82b1

Please sign in to comment.