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
......
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
解决方法: 上传你的资源class!在你的circleci/config.yml
jobs:
continuous-integration:
resource_class: large
不明显,因为没有 memory/resource 警告,但根据 circle ci 团队:
When the machine runs out of memory processes are killed which could include the server.
该服务器是我试图启动的 cra-server
。我提升了资源 class 并且瞧瞧它 运行 并且被 cypress 发现了!在我们的案例中,我们将它从中型提升到大型 class,但对您来说可能有所不同。
这是您可以使用的可用资源 class:
我运行在用 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
......
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
解决方法: 上传你的资源class!在你的circleci/config.yml
jobs:
continuous-integration:
resource_class: large
不明显,因为没有 memory/resource 警告,但根据 circle ci 团队:
When the machine runs out of memory processes are killed which could include the server.
该服务器是我试图启动的 cra-server
。我提升了资源 class 并且瞧瞧它 运行 并且被 cypress 发现了!在我们的案例中,我们将它从中型提升到大型 class,但对您来说可能有所不同。
这是您可以使用的可用资源 class: