[英]How do I create a GitHub Action to run Jest tests with Yarn?
I use Yarn to run my Jest tests.我使用Yarn来运行我的Jest测试。
package.json
{
"scripts": {
"test": "jest"
}
}
yarn test
I want to create a GitHub action to run my tests when I merge commits in GitHub.当我在 GitHub 中合并提交时,我想创建一个GitHub 操作来运行我的测试。 The Node Starter Workflow runs tests with NPM.
Node Starter Workflow使用 NPM 运行测试。 But I want to run them with Yarn.
但我想用 Yarn 运行它们。
How do I create an action to run my tests?如何创建一个操作来运行我的测试?
Use the Node Starter Workflow but replace the NPM portion with Yarn commands.使用Node Starter Workflow ,但将 NPM 部分替换为 Yarn 命令。 For example:
例如:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.