Circle Ci-启动react服务器并通过柏树进行测试



我在cirleci脚本中启动的服务器上运行柏树。尽管赛柏找不到我刚启动的本地服务器。这是我的脚本/设置。我也尝试过cyprcirclci-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
......

Cypress测试开始并得到以下错误

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团队的说法:

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

那个服务器就是我试图启动的cra-server。我提高了资源等级,瞧,它跑了,被柏树发现了!在我们的案例中,我们把它从中等级别提升到了大级别,但对你来说可能会有所不同。

以下是您可以使用的可用资源类:

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

最新更新