From c9b82b1feaaeebfb05acddca945d534115c1d692 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 10f215b6a9..efe291be51 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/mount.ts b/src/mount.ts index f3c383d961..74df2cfa00 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -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) }