From 2f522ac3add4bdbc9d967f787820eddabd80ee46 Mon Sep 17 00:00:00 2001 From: xyhxx <603331487@qq.com> Date: Sat, 13 May 2023 15:30:43 +0800 Subject: [PATCH] modify test --- __tests__/components/network.vue | 35 +++---- __tests__/includeAndExclude.test.ts | 4 +- __tests__/propagation.test.ts | 2 + __tests__/suspense.test.ts | 9 +- package.json | 1 - pnpm-lock.yaml | 146 +--------------------------- 6 files changed, 20 insertions(+), 177 deletions(-) diff --git a/__tests__/components/network.vue b/__tests__/components/network.vue index 8504f47..23f5ea4 100644 --- a/__tests__/components/network.vue +++ b/__tests__/components/network.vue @@ -1,35 +1,26 @@ diff --git a/__tests__/includeAndExclude.test.ts b/__tests__/includeAndExclude.test.ts index c1d05e6..6386ae8 100644 --- a/__tests__/includeAndExclude.test.ts +++ b/__tests__/includeAndExclude.test.ts @@ -5,7 +5,7 @@ import Caputre from './components/capture.vue'; import ClickTypeError from './components/typeError.vue'; import ClickRefError from './components/refError.vue'; import { mount } from '@vue/test-utils'; -import { defineComponent, h } from 'vue'; +import { defineComponent, h, onErrorCaptured } from 'vue'; import { describe, test, beforeEach, expect } from 'vitest'; let App: any; @@ -24,6 +24,8 @@ describe('include, exclude, keepEmit', function () { emit('captured', error); }; + onErrorCaptured(() => false); + return function () { return h( ErrorBoundary, diff --git a/__tests__/propagation.test.ts b/__tests__/propagation.test.ts index e7caee5..9eaf08c 100644 --- a/__tests__/propagation.test.ts +++ b/__tests__/propagation.test.ts @@ -27,6 +27,8 @@ describe('onErrorCaptured propagation', function () { onErrorCaptured(function (errors) { fn(); props.cb?.(errors); + + return false; }); return function () { diff --git a/__tests__/suspense.test.ts b/__tests__/suspense.test.ts index bd701e6..a213838 100644 --- a/__tests__/suspense.test.ts +++ b/__tests__/suspense.test.ts @@ -3,11 +3,8 @@ import { mount, flushPromises } from '@vue/test-utils'; import { defineComponent, h, ref, Suspense } from 'vue'; import Caputre from './components/capture.vue'; import NetworkCom from './components/network.vue'; -import { QueryClient } from 'vue-query'; import { vi, describe, test, expect } from 'vitest'; -const client = new QueryClient(); - vi.mock('axios'); const App = defineComponent({ @@ -47,11 +44,7 @@ const App = defineComponent({ describe('suspense', function () { test('network and suspense', async function () { - const app = mount(App, { - global: { - provide: { VUE_QUERY_CLIENT: client }, - }, - }); + const app = mount(App); const loading = app.find('#loading'); expect(loading.exists()).toBe(true); diff --git a/package.json b/package.json index 8f2a2d0..c44a26f 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "vitest": "^0.12.9", "vue": "^3.2.34", "vue-eslint-parser": "^9.0.2", - "vue-query": "^1.25.0", "vue-tsc": "^0.34.15" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97d7a10..d4a18a5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,9 +66,6 @@ devDependencies: vue-eslint-parser: specifier: ^9.0.2 version: 9.0.2(eslint@8.16.0) - vue-query: - specifier: ^1.25.0 - version: 1.25.0(react@18.2.0)(vue@3.2.35) vue-tsc: specifier: ^0.34.15 version: 0.34.15(typescript@4.6.4) @@ -88,13 +85,6 @@ packages: '@babel/types': 7.18.0 dev: true - /@babel/runtime@7.18.3: - resolution: {integrity: sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==} - engines: {node: '>=6.9.0'} - dependencies: - regenerator-runtime: 0.13.9 - dev: true - /@babel/types@7.18.0: resolution: {integrity: sha512-vhAmLPAiC8j9K2GnsnLPCIH5wCrPpYIVBCWRBFDCB7Y/BXLqi/O+1RSTTM2bsmg6U/551+FCf9PNPxjABmxHTw==} engines: {node: '>=6.9.0'} @@ -505,6 +495,7 @@ packages: /@vue/devtools-api@6.1.4: resolution: {integrity: sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==} + dev: false /@vue/reactivity-transform@3.2.35: resolution: {integrity: sha512-VjdQU4nIrgsh1iPqAdYZufWgFqdH9fIl6ttO2PCFlLsrQl7b8BcuawM6moSBLF8damBzSNcqvbvQDBhsI3fyVQ==} @@ -682,11 +673,6 @@ packages: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true - /big-integer@1.6.51: - resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} - engines: {node: '>=0.6'} - dev: true - /boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} dev: true @@ -711,19 +697,6 @@ packages: fill-range: 7.0.1 dev: true - /broadcast-channel@3.7.0: - resolution: {integrity: sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==} - dependencies: - '@babel/runtime': 7.18.3 - detect-node: 2.1.0 - js-sha3: 0.8.0 - microseconds: 0.2.0 - nano-time: 1.0.0 - oblivious-set: 1.0.0 - rimraf: 3.0.2 - unload: 2.2.0 - dev: true - /browser-process-hrtime@1.0.0: resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} dev: true @@ -942,10 +915,6 @@ packages: engines: {node: '>=0.4.0'} dev: true - /detect-node@2.1.0: - resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - dev: true - /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -1971,14 +1940,6 @@ packages: resolution: {integrity: sha1-o6vicYryQaKykE+EpiWXDzia4yo=} dev: true - /js-sha3@0.8.0: - resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==} - dev: true - - /js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: true - /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -2109,13 +2070,6 @@ packages: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true - /loose-envify@1.4.0: - resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} - hasBin: true - dependencies: - js-tokens: 4.0.0 - dev: true - /loupe@2.3.4: resolution: {integrity: sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==} dependencies: @@ -2142,13 +2096,6 @@ packages: semver: 6.3.0 dev: true - /match-sorter@6.3.1: - resolution: {integrity: sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==} - dependencies: - '@babel/runtime': 7.18.3 - remove-accents: 0.4.2 - dev: true - /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -2162,10 +2109,6 @@ packages: picomatch: 2.3.1 dev: true - /microseconds@0.2.0: - resolution: {integrity: sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==} - dev: true - /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} @@ -2213,12 +2156,6 @@ packages: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} dev: true - /nano-time@1.0.0: - resolution: {integrity: sha1-sFVPaa2J4i0JB/ehKwmTpdlhN+8=} - dependencies: - big-integer: 1.6.51 - dev: true - /nanoid@3.3.4: resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -2267,10 +2204,6 @@ packages: es-abstract: 1.20.1 dev: true - /oblivious-set@1.0.0: - resolution: {integrity: sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==} - dev: true - /once@1.4.0: resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=} dependencies: @@ -2437,35 +2370,6 @@ packages: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true - /react-query@3.39.0(react@18.2.0): - resolution: {integrity: sha512-Od0IkSuS79WJOhzWBx/ys0x13+7wFqgnn64vBqqAAnZ9whocVhl/y1padD5uuZ6EIkXbFbInax0qvY7zGM0thA==} - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: '*' - react-native: '*' - peerDependenciesMeta: - react-dom: - optional: true - react-native: - optional: true - dependencies: - '@babel/runtime': 7.18.3 - broadcast-channel: 3.7.0 - match-sorter: 6.3.1 - react: 18.2.0 - dev: true - - /react@18.2.0: - resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} - engines: {node: '>=0.10.0'} - dependencies: - loose-envify: 1.4.0 - dev: true - - /regenerator-runtime@0.13.9: - resolution: {integrity: sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==} - dev: true - /regexp.prototype.flags@1.4.3: resolution: {integrity: sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==} engines: {node: '>= 0.4'} @@ -2480,10 +2384,6 @@ packages: engines: {node: '>=8'} dev: true - /remove-accents@0.4.2: - resolution: {integrity: sha1-CkPTqq4egNuRngeuJUsoXZ4ce7U=} - dev: true - /require-directory@2.1.1: resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=} engines: {node: '>=0.10.0'} @@ -2818,13 +2718,6 @@ packages: engines: {node: '>= 10.0.0'} dev: true - /unload@2.2.0: - resolution: {integrity: sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==} - dependencies: - '@babel/runtime': 7.18.3 - detect-node: 2.1.0 - dev: true - /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -2931,20 +2824,6 @@ packages: - supports-color dev: true - /vue-demi@0.10.1(vue@3.2.35): - resolution: {integrity: sha512-L6Oi+BvmMv6YXvqv5rJNCFHEKSVu7llpWWJczqmAQYOdmPPw5PNYoz1KKS//Fxhi+4QP64dsPjtmvnYGo1jemA==} - hasBin: true - requiresBuild: true - peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue: ^2.6.0 || >=3.0.0 - peerDependenciesMeta: - '@vue/composition-api': - optional: true - dependencies: - vue: 3.2.35 - dev: true - /vue-eslint-parser@9.0.2(eslint@8.16.0): resolution: {integrity: sha512-uCPQwTGjOtAYrwnU+76pYxalhjsh7iFBsHwBqDHiOPTxtICDaraO4Szw54WFTNZTAEsgHHzqFOu1mmnBOBRzDA==} engines: {node: ^14.17.0 || >=16.0.0} @@ -2963,29 +2842,6 @@ packages: - supports-color dev: true - /vue-query@1.25.0(react@18.2.0)(vue@3.2.35): - resolution: {integrity: sha512-CDGPHtcZBoK/jOKKxazExHsfw0L7MEZiqh/4xiq5yxbfxb55M6CEH82Fw7p2VMhl4rCWFKj67oX5GSF9YUzi1g==} - peerDependencies: - '@nuxtjs/composition-api': ^0.28.0 - '@vue/composition-api': ^1.1.2 - vue: ^2.0.0 || >=3.0.0 - peerDependenciesMeta: - '@nuxtjs/composition-api': - optional: true - '@vue/composition-api': - optional: true - dependencies: - '@vue/devtools-api': 6.1.4 - match-sorter: 6.3.1 - react-query: 3.39.0(react@18.2.0) - vue: 3.2.35 - vue-demi: 0.10.1(vue@3.2.35) - transitivePeerDependencies: - - react - - react-dom - - react-native - dev: true - /vue-tsc@0.34.15(typescript@4.6.4): resolution: {integrity: sha512-xRNaOpg/UCHnRcz9vOdbIjB7uCQ0mifHpqNaejAho7em4WLOzNdJx4R9HMJrqWek44keg7AblIiwM+86QfXx9g==} hasBin: true