在 Circle CI 中运行 Cypress Orb 时,我的 Node 服务器没有启动。任何想法我错过了什么? (它在 Circle 环境之外本地工作)
我已经使用 cypress 设置了一个简单的集成测试,并在 package.json 中定义了两个命令以便能够执行它。
npm run cy:startserver
npm run cy:run
这些命令设置了一些在启动时需要运行测试的标志。
"cy:run": "cypress run",
"cy:startserver": "MOCK_ARTICLES=1 CONTENT_CACHE_URL= node server/index.js"
运行这两个命令输出
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ article.spec.js 00:03 2 2 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 00:03 2 2 - - -
在 Circle CI 配置中,我定义了 Cypress Orb 并传入了启动命令和等待。
version: 2.1
orbs:
node: circleci/node@4.1
cypress: cypress-io/cypress@1
...
jobs:
- cypress/run:
start: npm run cy:startserver
wait-on: 'http://127.0.0.1:3000'
但是在本地和远程运行作业时,服务器永远不会启动。
我正在运行的命令是 circleci local execute --job cypress/run
====>> Wait-on http://127.0.0.1:3000
#!/bin/bash -eo pipefail
npx wait-on http://127.0.0.1:3000
Error:
Too long with no output (exceeded 10m0s): context deadline exceeded
Step timedout
Step canceled
Error: runner failed (exited with 101)
Task failed
Error: task failed