D
D
Dmitry Ivchenkov2021-03-29 21:20:08
Continuous Integration
Dmitry Ivchenkov, 2021-03-29 21:20:08

How to arrange CI for tests?

There is a project with react and jest tests.

I want to run tests and report coverage on every push (jest --coverage).

I wrote a yaml script as best I could, but it doesn't work, I don't understand why. How to make it work correctly?

name: CI
on: [push]
jobs:
  build:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - name: Installation
      - uses: actions/[email protected]
      - uses: borales/[email protected]
        with:
          cmd: install # will run `yarn install` command
      - uses: borales/[email protected]
        with:
          cmd: test # will run `yarn test` command
      - uses: borales/[email protected]
        with:
          cmd: run jest --coverage # will run `yarn run jest` command
      - name: Jest Coverage Commenter
        # You may pin to the exact commit or the version.
        # uses: dkershner6/[email protected]bf02941
      - uses: dkershner6/[email protected]
        with:
          test_command: # optional, default is npx jest --coverage
            "jest --coverage"
          reporter: 
            "HoneyWood Reporter"


Upd. Interested in CI, i.e. github actions scripts.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kirshin, 2021-03-29
@meowto16

I didn't really go into your yaml file. On the topic of the question - you can use husky, pre-push setting in his config. Will look like this in package.json

{
// ...package.json
  "husky": {
    "hooks": {
      "pre-push": "jest --coverage"
    }
  },
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question