与柏树E2E的类星体CLI项目不从事github动作
我正在与Vite Project的类星体CLI合作。我使用柏树E2E安装了测试扩展,并在计算机上进行了一些测试。
我的env是:macos 12。节点16。
然后我尝试实现一个使用github操作的CI,这是代码:
ci.yml
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup node env
uses: actions/[email protected]
with:
node-version: 16
check-latest: true
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
- name: Run e2e tests
run: npm run test:e2e:ci
它使显示此错误的测试失败:
未能获取动态导入的模块:http:// localhost:9000/src/boot/axios.js
如何给出该错误?此文件存在。在我的计算机中,测试正在通过,该应用程序正常工作...我不知道该怎么办...代码是相同的,如何在我的github操作上工作?
我该如何调试这个问题?
编辑:我试图更改跑步道具,但也没有Macos-Latest失败...所以我不明白发生了什么。
谢谢
I'm working with a Quasar CLI with vite project. I installed the testing extension with cypress e2e and do some tests and on my computer are passing.
My env is: Macos 12. Node 16.
Then I tried to implement a CI with github actions, and this is the code:
ci.yml
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup node env
uses: actions/[email protected]
with:
node-version: 16
check-latest: true
- name: Install dependencies
run: npm ci --prefer-offline --no-audit
- name: Run e2e tests
run: npm run test:e2e:ci
It fails the test showing this error:
Failed to fetch dynamically imported module: http://localhost:9000/src/boot/axios.js
How can give that error? This file exists. In my computer the tests are passing, the app is working fine... I don't know what to do... the code is the same, how can work on mine and fail on github actions?
How can I debug this problem?
EDIT: I was trying to change the runs-on prop but it fails with macos-latest too... so I don't understand what is going on.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道为什么确切会产生此错误,但我可以解决问题。
阅读柏树文档,我找到了本节:
https:https:// docs。 cypress.io/api/events/catalog-of-events#uncaught-exceptions
因此,柏树在解雇异常时会失败。
仅针对尝试的事情,我做了一些文档,以避免触发异常时的测试失败:
在:
/test/cypress/supprest/support/index.js
中添加此代码,并传递了测试:D
令我担心的是什么是在这样做,我忽略了所有例外,但是与此同时,如果我的应用程序正在触发异常,则可能无法正常工作,因此无论如何都会使测试失败。
与Quasar Core成员交谈,似乎Vite在编译时进行了几次重新加载,因此这可能是问题所在。
在第一个加载时,文件
src/boot/axios.js.js
不存在并发射异常,柏树停止了跑步者。添加片段柏树等待应用程序运行,进行几个重新加载,事实是,当应用程序准备就绪时,Axios文件存在。如果有人有更好的解决方案,我想听听:)
I don't figure out why exactly produces this error, but I could solve the problem.
Reading cypress documentation I found this section:
https://docs.cypress.io/api/events/catalog-of-events#Uncaught-Exceptions
So cypress fails the tests when an exception is fired.
Just for trying things I did what docs suggest to avoid failing tests when an exception is fired:
Adding this code in:
/test/cypress/support/index.js
And tests are passed :D
What worries me is doing that I'm ignoring all the exceptions, but in the same time, if my app is firing exceptions probably it's not going to work fine so it will fail the tests anyway.
Talking with Quasar core members, seems that Vite does a couple of reloads while compiling, so probably this is the problem.
On the first load the file
src/boot/axios.js
does not exist and fires the exception, and cypress stops the runner. Adding the snippet cypress waits for the application to run, doing a couple of reloads, the thing is, when the app is ready the axios file exists.If someone has a better solution I would like to hear it :)