From 51f839916ef7e5e6b012b4616494763a57147d38 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Mon, 30 Aug 2021 10:51:40 +0200 Subject: [PATCH] fix: remove hasOwnProperty workaround vue-test-utils-next now uses jest v27.1+, which includes a fix for hasOwnPropery (see https://github.com/facebook/jest/pull/11721). This allows to remove the dirty workaround we had in our codebase, but users will have to update to Jest v27.1+. --- package.json | 8 +++++++- src/mount.ts | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3a1fa1c851..2e62e7c7fe 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,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", diff --git a/src/mount.ts b/src/mount.ts index 401b9caf0a..69fc1875ea 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -507,10 +507,6 @@ 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 - appRef.hasOwnProperty = (property) => { - return Reflect.has(appRef, property) - } console.warn = warnSave const wrapper = createVueWrapper(app, appRef, setProps) trackInstance(wrapper)