【发布时间】:2020-02-13 20:23:25
【问题描述】:
我有一个非常简单的配置,以便在 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
【问题讨论】:
-
不知道是不是
npx wait-on http://localhost:3000的问题。你试过npx wait-on http://127.0.0.1:3000吗?我想我之前经历过一些localhost不起作用的事情。
标签: node.js continuous-integration next.js cypress github-actions