簡體   English   中英

Circle Ci - 啟動反應服務器並通過賽普拉斯進行測試

[英]Circle Ci - Start react server and test via cypress

我在以 cirleci 腳本啟動的服務器上運行 cypress。 雖然柏樹無法找到我剛啟動的本地服務器。 這是我的腳本/設置。 我也嘗試過 cypress circlci-orb 並得到同樣的錯誤,所以我嘗試自己運行一些東西來幫助調試。 這是腳本的詳細信息:

  - run:
      name: 'Run app tests'
      command: |
        cd app
        yarn install --frozen-lockfile
        yarn lint
        yarn cypress:ci

package.json 腳本:

"cypress:ci": "CYPRESS_BASE_URL=http://localhost:3000 yarn start & wait-on http-get://localhost:3000 && cypress run"

錯誤:

$ craco start
ℹ 「wds」: Project is running at http://192.168.208.3/
ℹ 「wds」: webpack output is served from 
ℹ 「wds」: Content not from webpack is served from /root/project/app/public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

.....
react startup output
......

賽普拉斯測試啟動並出現以下錯誤

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

  > Error: connect ECONNREFUSED 127.0.0.1:3000

解決方案:提高你的資源等級! 在你的circleci/config.yml

jobs:
  continuous-integration:
    resource_class: large

這並不明顯,因為沒有內存/資源警告,但根據 circle ci 團隊的說法:

When the machine runs out of memory processes are killed which could include the server.

該服務器是我試圖啟動的cra-server 我提升了資源 class,瞧,它運行了,被 cypress 發現了,在我們的例子中,我們將它從中型提升到大型 class。但對你來說可能有所不同。

以下是您可以使用的可用資源類:

https://circleci.com/product/features/resource-classes/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM