From 4ae97e3bb0a2c8b3006298a2d518a0b83d832296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Exbrayat?= Date: Wed, 13 Apr 2022 00:02:17 +0200 Subject: [PATCH] chore: bump to vue v3.2.32 (#1418) * chore: bump to vue v3.2.32 * fix(mount): shallowMount with Vue v3.2.32 v3.2.32 changed how the root component is used in `createApp` https://github.com/vuejs/core/commit/d121a9bc7e7af59adb2d2803954cfeee95b35270 The root component is now copied before usage. This broke how we stub components, as we used to add the root component to the list of component to not stub. As the component is now no longer the same, all tests using shallowMount are failing. The fix is to register the copy of the component created by Vue in `createApp` (which is available as `app._component`) --- package.json | 8 ++-- src/mount.ts | 8 +++- yarn.lock | 111 ++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 116 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 94a4be4c6..f01408eba 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "@typescript-eslint/eslint-plugin": "^5.19.0", "@typescript-eslint/parser": "^5.19.0", "@vue/babel-plugin-jsx": "^1.1.1", - "@vue/compat": "3.2.31", - "@vue/compiler-dom": "3.2.31", - "@vue/compiler-sfc": "3.2.31", + "@vue/compat": "3.2.32", + "@vue/compiler-dom": "3.2.32", + "@vue/compiler-sfc": "3.2.32", "@vue/vue3-jest": "27.0.0-alpha.4", "babel-jest": "27.5.1", "babel-preset-jest": "27.5.1", @@ -48,7 +48,7 @@ "tslib": "2.3.1", "typescript": "4.6.3", "vitepress": "^0.22.3", - "vue": "3.2.31", + "vue": "3.2.32", "vue-class-component": "^8.0.0-rc.1", "vue-jest": "^5.0.0-alpha.10", "vue-router": "^4.0.14", diff --git a/src/mount.ts b/src/mount.ts index 714191073..1d0965c8c 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -397,7 +397,6 @@ export function mount( return h(component, props, slots) } }) - addToDoNotStubComponents(Parent) const setProps = (newProps: Record) => { for (const [k, v] of Object.entries(newProps)) { @@ -409,6 +408,11 @@ export function mount( // create the app const app = createApp(Parent) + // the Parent type must not be stubbed + // but we can't add it directly, as createApp creates a copy + // and store it in app._component (since v3.2.32) + // So we store this one instead + addToDoNotStubComponents(app._component) // add tracking for emitted events // this must be done after `createApp`: https://github.com/vuejs/test-utils/issues/436 @@ -503,7 +507,7 @@ export function mount( // mount the app! const vm = app.mount(el) - // Ingore Avoid app logic that relies on enumerating keys on a component instance... warning + // Ignore "Avoid app logic that relies on enumerating keys on a component instance..." warning const warnSave = console.warn console.warn = () => {} diff --git a/yarn.lock b/yarn.lock index 4996e0c8f..aa9a6c9ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1736,10 +1736,10 @@ html-tags "^3.1.0" svg-tags "^1.0.0" -"@vue/compat@3.2.31": - version "3.2.31" - resolved "https://registry.yarnpkg.com/@vue/compat/-/compat-3.2.31.tgz#9c8bdf265eeba1777e5edb56cda73581e351a648" - integrity sha512-hhwJk/SRwpT2OADctj+t7QZCRIgh04AcelGpe6gdj0OxA75xpHnPrG+fmG37U3Z6WDrNHZpGvu2eXBzWXM4OVA== +"@vue/compat@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/compat/-/compat-3.2.32.tgz#8b341535af99e77316447809fc75a57d93a2f4a5" + integrity sha512-IlGiUFidAmpUpM6xvBpPn9jI3m1Czv5/g+pCMZfcS/ebpHD4D0ptW+ipsAyIRQBDSmQMLUUYKaDSNo7lGNjEaQ== "@vue/compiler-core@3.2.31", "@vue/compiler-core@^3.2.31": version "3.2.31" @@ -1751,6 +1751,16 @@ estree-walker "^2.0.2" source-map "^0.6.1" +"@vue/compiler-core@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.32.tgz#a0be08214c55ae48092b413d8b552c0573e3a883" + integrity sha512-bRQ8Rkpm/aYFElDWtKkTPHeLnX5pEkNxhPUcqu5crEJIilZH0yeFu/qUAcV4VfSE2AudNPkQSOwMZofhnuutmA== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/shared" "3.2.32" + estree-walker "^2.0.2" + source-map "^0.6.1" + "@vue/compiler-dom@3.2.31", "@vue/compiler-dom@^3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.31.tgz#b1b7dfad55c96c8cc2b919cd7eb5fd7e4ddbf00e" @@ -1759,6 +1769,14 @@ "@vue/compiler-core" "3.2.31" "@vue/shared" "3.2.31" +"@vue/compiler-dom@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.32.tgz#8ddae1ee463c18c5c3353c4716ec7c84ee29e5ad" + integrity sha512-maa3PNB/NxR17h2hDQfcmS02o1f9r9QIpN1y6fe8tWPrS1E4+q8MqrvDDQNhYVPd84rc3ybtyumrgm9D5Rf/kg== + dependencies: + "@vue/compiler-core" "3.2.32" + "@vue/shared" "3.2.32" + "@vue/compiler-sfc@3.2.31", "@vue/compiler-sfc@^3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.31.tgz#d02b29c3fe34d599a52c5ae1c6937b4d69f11c2f" @@ -1775,6 +1793,22 @@ postcss "^8.1.10" source-map "^0.6.1" +"@vue/compiler-sfc@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.32.tgz#63e09762812b985aa97876fb5cc3265ba8990a8a" + integrity sha512-uO6+Gh3AVdWm72lRRCjMr8nMOEqc6ezT9lWs5dPzh1E9TNaJkMYPaRtdY9flUv/fyVQotkfjY/ponjfR+trPSg== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/compiler-core" "3.2.32" + "@vue/compiler-dom" "3.2.32" + "@vue/compiler-ssr" "3.2.32" + "@vue/reactivity-transform" "3.2.32" + "@vue/shared" "3.2.32" + estree-walker "^2.0.2" + magic-string "^0.25.7" + postcss "^8.1.10" + source-map "^0.6.1" + "@vue/compiler-ssr@3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.31.tgz#4fa00f486c9c4580b40a4177871ebbd650ecb99c" @@ -1783,6 +1817,14 @@ "@vue/compiler-dom" "3.2.31" "@vue/shared" "3.2.31" +"@vue/compiler-ssr@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.32.tgz#06cf7539c483ba4a25b30bd6741e440c222d4c02" + integrity sha512-ZklVUF/SgTx6yrDUkaTaBL/JMVOtSocP+z5Xz/qIqqLdW/hWL90P+ob/jOQ0Xc/om57892Q7sRSrex0wujOL2Q== + dependencies: + "@vue/compiler-dom" "3.2.32" + "@vue/shared" "3.2.32" + "@vue/devtools-api@^6.0.0", "@vue/devtools-api@^6.0.0-beta.11": version "6.0.12" resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.12.tgz#7b57cce215ae9f37a86984633b3aa3d595aa5b46" @@ -1799,6 +1841,17 @@ estree-walker "^2.0.2" magic-string "^0.25.7" +"@vue/reactivity-transform@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.32.tgz#974fd2a1e682e962fbc5840be8432ac4ab8650d3" + integrity sha512-CW1W9zaJtE275tZSWIfQKiPG0iHpdtSlmTqYBu7Y62qvtMgKG5yOxtvBs4RlrZHlaqFSE26avLAgQiTp4YHozw== + dependencies: + "@babel/parser" "^7.16.4" + "@vue/compiler-core" "3.2.32" + "@vue/shared" "3.2.32" + estree-walker "^2.0.2" + magic-string "^0.25.7" + "@vue/reactivity@3.2.31", "@vue/reactivity@^3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.31.tgz#fc90aa2cdf695418b79e534783aca90d63a46bbd" @@ -1806,6 +1859,13 @@ dependencies: "@vue/shared" "3.2.31" +"@vue/reactivity@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.32.tgz#a859c8ab28a297d14a46cbd450bf70b3f6f87fac" + integrity sha512-4zaDumuyDqkuhbb63hRd+YHFGopW7srFIWesLUQ2su/rJfWrSq3YUvoKAJE8Eu1EhZ2Q4c1NuwnEreKj1FkDxA== + dependencies: + "@vue/shared" "3.2.32" + "@vue/runtime-core@3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.31.tgz#9d284c382f5f981b7a7b5971052a1dc4ef39ac7a" @@ -1814,6 +1874,14 @@ "@vue/reactivity" "3.2.31" "@vue/shared" "3.2.31" +"@vue/runtime-core@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.32.tgz#8f8875dc032f99991bafb72070327ae5584a08dd" + integrity sha512-uKKzK6LaCnbCJ7rcHvsK0azHLGpqs+Vi9B28CV1mfWVq1F3Bj8Okk3cX+5DtD06aUh4V2bYhS2UjjWiUUKUF0w== + dependencies: + "@vue/reactivity" "3.2.32" + "@vue/shared" "3.2.32" + "@vue/runtime-dom@3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.31.tgz#79ce01817cb3caf2c9d923f669b738d2d7953eff" @@ -1823,6 +1891,15 @@ "@vue/shared" "3.2.31" csstype "^2.6.8" +"@vue/runtime-dom@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.32.tgz#53a8be5c9d72105faf4d11d10202063e9a29c39c" + integrity sha512-AmlIg+GPqjkNoADLjHojEX5RGcAg+TsgXOOcUrtDHwKvA8mO26EnLQLB8nylDjU6AMJh2CIYn8NEgyOV5ZIScQ== + dependencies: + "@vue/runtime-core" "3.2.32" + "@vue/shared" "3.2.32" + csstype "^2.6.8" + "@vue/server-renderer@3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.31.tgz#201e9d6ce735847d5989403af81ef80960da7141" @@ -1831,11 +1908,24 @@ "@vue/compiler-ssr" "3.2.31" "@vue/shared" "3.2.31" +"@vue/server-renderer@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.32.tgz#432e0cb766feabe3b97956ae37b8f75c239f2c37" + integrity sha512-TYKpZZfRJpGTTiy/s6bVYwQJpAUx3G03z4G7/3O18M11oacrMTVHaHjiPuPqf3xQtY8R4LKmQ3EOT/DRCA/7Wg== + dependencies: + "@vue/compiler-ssr" "3.2.32" + "@vue/shared" "3.2.32" + "@vue/shared@3.2.31", "@vue/shared@^3.2.31": version "3.2.31" resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.31.tgz#c90de7126d833dcd3a4c7534d534be2fb41faa4e" integrity sha512-ymN2pj6zEjiKJZbrf98UM2pfDd6F2H7ksKw7NDt/ZZ1fh5Ei39X5tABugtT03ZRlWd9imccoK0hE8hpjpU7irQ== +"@vue/shared@3.2.32": + version "3.2.32" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.32.tgz#1ca0c3b8c03a5e24129156e171df736b2c1d645f" + integrity sha512-bjcixPErUsAnTQRQX4Z5IQnICYjIfNCyCl8p29v1M6kfVzvwOICPw+dz48nNuWlTOOx2RHhzHdazJibE8GSnsw== + "@vue/vue3-jest@27.0.0-alpha.4": version "27.0.0-alpha.4" resolved "https://registry.yarnpkg.com/@vue/vue3-jest/-/vue3-jest-27.0.0-alpha.4.tgz#eb2e5eba1c7a0ae39e457ba2df7ac891a79a2402" @@ -5242,7 +5332,18 @@ vue-tsc@0.34.5: dependencies: "@volar/vue-typescript" "0.34.5" -vue@3.2.31, vue@^3.2.31: +vue@3.2.32: + version "3.2.32" + resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.32.tgz#a09840e237384c673f421ff7280c4469714f2ac0" + integrity sha512-6L3jKZApF042OgbCkh+HcFeAkiYi3Lovi8wNhWqIK98Pi5efAMLZzRHgi91v+60oIRxdJsGS9sTMsb+yDpY8Eg== + dependencies: + "@vue/compiler-dom" "3.2.32" + "@vue/compiler-sfc" "3.2.32" + "@vue/runtime-dom" "3.2.32" + "@vue/server-renderer" "3.2.32" + "@vue/shared" "3.2.32" + +vue@^3.2.31: version "3.2.31" resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.31.tgz#e0c49924335e9f188352816788a4cca10f817ce6" integrity sha512-odT3W2tcffTiQCy57nOT93INw1auq5lYLLYtWpPYQQYQOOdHiqFct9Xhna6GJ+pJQaF67yZABraH47oywkJgFw==