node.js - 如何创建 GitHub Action 以使用 Yarn 运行 Jest 测试?
问题描述
package.json
{
"scripts": {
"test": "jest"
}
}
yarn test
当我在 GitHub 中合并提交时,我想创建一个GitHub 操作来运行我的测试。Node Starter Workflow使用NPM 运行测试。但我想用 Yarn 运行它们。
如何创建一个操作来运行我的测试?
解决方案
使用Node Starter Workflow,但将 NPM 部分替换为 Yarn 命令。例如:
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test
推荐阅读
- db2 - 更正我遇到错误的 DB2 查询
- javascript - Draftable.com API 在 Google App Script 中传递 JSON 时给出截断响应
- c# - 如何在 C# 的泛型函数中传递类型
- c++ - 具有默认构造函数的类的成员是否零初始化?
- java - 解决方案中的重复计划实体
- go - 在 Go 中创建一个并行单词计数器
- node.js - azure blob storage nodejs v10 - 应用程序抛出未捕获的异常并终止
- c# - Exception: DataAnalysis.Reference+<>c__DisplayClass4 is not serializable
- javascript - 有没有办法在按下按钮后更改表单两次选择(两次选择)的动作?
- reactive-programming - Spring Data Couchbase 反应式是否支持分页?