node.js - github-actions 如何在(生产)构建结果而不是开发模式上运行测试
问题描述
我目前在 Create React App 中有这样的 github 操作
name: Percy
on: [push]
jobs:
percy:
name: Visual Testing
runs-on: ubuntu-16.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v2
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
with:
start: yarn start
wait-on: 'http://localhost:3000'
command-prefix: 'percy exec -- npx'
但我想yarn build
(而不是yarn start
)和serve
这些结果用于我的测试(柏树等) - 所以我看到测试是如何进行的webpack
。
我尝试了很多不同的东西(比如start: yarn build && yarn serve -s build -p 3000
),但得出的结论是我需要一些指导。
...
$ react-scripts build '&&' yarn serve -s build -p 3000
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
49.3 KB build/static/js/2.98954ae7.chunk.js
3.01 KB build/static/js/main.9bc31c1d.chunk.js
1.13 KB build/static/css/main.9e43f7ef.chunk.css
818 B build/static/css/2.a2fbc952.chunk.css
779 B build/static/js/runtime-main.fe4fcbcb.js
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
bit.ly/CRA-deploy
Done in 10.36s.
http://localhost:3000 timed out on retry 61 of 2
Error: connect ECONNREFUSED 127.0.0.1:3000
解决方案
推荐阅读
- ssis - 使用SSIS中的循环将数据加载到单个excel文件中
- node.js - 改变 fs.createReadstream 的内容
- python - 如何在python中遍历不同的文件名
- c++ - 如何更改 C++ 中的分隔符 [for csv]
- swiftui - SwitfUI - 定时器不重置
- javascript - React Native Fetch Remote Http 请求抛出网络请求失败(在 Android 设备上)
- javascript - 未捕获的类型错误:无法读取未定义的属性“clearRect”
- c++ - C ++:调用对象方法的回调处理程序
- slack-api - SlackAPI - 包括对话框输入和原始消息
- google-cloud-platform - 我应该为 Tiktok 克隆应用程序使用 Google Cloud Storage 还是 Unlimited Google Drive