rfc*_*484 2 continuous-integration node.js next.js cypress github-actions
我有一个非常简单的配置,以便在 Nextjs 应用程序中使用 Github Actions 使用 Cypress 运行 e2e 测试。当它到达npm start命令时,尽管它似乎可以工作,因为它给出了正确的输出: > Ready on http://localhost:3000,但该步骤保持挂起状态,而不会前进到下一步。
对于如何解决这个问题,有任何的建议吗?
遵循 github 操作配置 ( .github/workflows/nodejs.yml):
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm ci
npm run build --if-present
npm start
npx wait-on http://localhost:3000
env:
CI: true
- name: Run Cypress
run: |
npx cypress run
env:
CI: true
Run Code Online (Sandbox Code Playgroud)
使用控制运算符&对我有用。请尝试以下操作。
- name: npm install, build, and test
run: |
npm ci
npm run build --if-present
npm start & npx wait-on http://localhost:3000
env:
CI: true
Run Code Online (Sandbox Code Playgroud)
来自man bash
如果命令由控制运算符 & 终止,shell 将在子 shell 的后台执行该命令。shell 不会等待命令完成,返回状态为 0。这些被称为异步命令。以 ; 分隔的命令 依次执行;shell 依次等待每个命令终止。返回状态是最后执行的命令的退出状态。
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |