由于某种原因,VueUse破坏了我在Cypress component testing中的测试。无论我使用哪种composable,它都会抛出错误> ref is not defined或> watch is not defined。我查看了源代码,注意到vueuse在幕后使用vue-demi,所有问题都与从vue-demi导入有关。但是我试图单独从vue-demi导入一些东西,它可以工作,所以我不明白为什么它会和vueuse一起崩溃。
我的设置Vue 3+ Vite。重现: Cypress Vitesse starter模板已经有了Vue3/Vite和VueUse,所以我刚刚添加了https://github.com/chojnicki/vitesse,在运行yarn cypress run-ct后出现了同样的错误
我试着让它在codesandbox上运行,但由于缺少系统库,Cypress无法在那里工作。
这是个bug,还是我漏掉了什么?
日志:
at Object.ref (http://localhost:35783/__cypress/src/node_modules/.vite/@vueuse_core.js?v=9e0ceea7:94:17)
at useMediaQuery (http://localhost:35783/__cypress/src/node_modules/.vite/@vueuse_core.js?v=9e0ceea7:1152:41)
at usePreferredDark (http://localhost:35783/__cypress/src/node_modules/.vite/@vueuse_core.js?v=9e0ceea7:1379:11)
at useDark (http://localhost:35783/__cypress/src/node_modules/.vite/@vueuse_core.js?v=9e0ceea7:1383:26)
at <unknown> (http://localhost:35783/__cypress/src/src/logic/dark.ts:2:24)
From previous event:
at Object.runScripts (http://localhost:35783/__cypress/runner/cypress_runner.js:159792:22)
at $Cypress.onSpecWindow (http://localhost:35783/__cypress/runner/cypress_runner.js:149271:19)
at <unknown> (http://localhost:35783/__cypress/src/@fs//home/chojnicki/vitesse/node_modules/@cypress/vite-dev-server/client/initCypressTests.js:22:18)发布于 2021-08-26 14:40:26
https://stackoverflow.com/questions/67308944
复制相似问题