赛普拉斯组件测试不适用于可组合的VueUse-“ref未定义”
出于某种原因,VueUse破坏了我在Cypress 组件测试中的测试。无论我使用什么可组合,它都会抛出错误
> ref is not defined或> watch is not defined. 我检查了来源并注意到 vueuse在引擎盖下使用vue-demi,所有问题都与从 vue-demi 导入有关。但是我试图单独从 vue-demi 导入一些东西,并且它有效,所以我很困惑为什么它会与 vueuse 崩溃。
我的设置 Vue 3 + Vite。复现:https : //github.com/chojnicki/vitesse Vitesse starter模板已经有Vue3/Vite和VueUse了,所以我刚刚加了Cypress,运行后出现同样的错误yarn cypress run-ct
我厌倦了在 codeandbox 上实现它,但是由于缺少系统库,Cypress 无法在那里工作。
这是一个错误还是我在这里遗漏了什么?
日志:
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)