Giter Site home page Giter Site logo

artiomtr / jest-coverage-report-action Goto Github PK

View Code? Open in Web Editor NEW
460.0 4.0 134.0 13.98 MB

Track your code coverage in every pull request.

Home Page: https://www.covbot.dev

License: MIT License

TypeScript 99.45% JavaScript 0.41% Shell 0.14%
coverage-reporters threshold jest actions action github-action github-actions github-actions-ci annotations

jest-coverage-report-action's People

Contributors

aaimio avatar aj8k avatar allcontributors[bot] avatar armfazh avatar artiomtr avatar atuttle avatar bohdanpetryshyn avatar chrisui avatar coopbri avatar dalevfenton avatar ddlan avatar dependabot[bot] avatar floby avatar github-actions[bot] avatar herberttn avatar hyperair avatar italoiz avatar jacoblincool avatar jaylenw avatar jgillick avatar maciejtutak avatar mattjw79 avatar mh4gf avatar nikodevv avatar p13i avatar raigen avatar taschetto avatar yama-sitter avatar ybiquitous avatar zajozor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jest-coverage-report-action's Issues

Action fails when using `replaceAll` in codebase

Hello! We're getting a .replaceAll is not a function error when running this action on codebase that contains .replaceAll (assuming due to an older Node version).

Even after trying to specify the node version via:

strategy:
  matrix:
    node-version: [15.x]

The error still occurs.

Anything we're missing config wise?
Thanks

Not show coverage result if is good

When the code coverage is optimal, not show the report, is empty:

jobs:
coverage:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- uses: artiomtr/[email protected]
with:
working_directory: frontend
github_token: ${{ secrets.GITHUB_TOKEN }}
threshold: 10

The job is complete

Fatal github credentials

When I push my changes, I receive this message in the execution of action:

/usr/bin/git fetch --all --depth=1
Fetching origin
fatal: could not read Username for 'https://github.com': No such device or address
error: Could not fetch origin
Error: The process '/usr/bin/git' failed with exit code 1

What is happen?

Permissions for the token

I would love to incorporate this into my organisations repositories as it ticks all of the boxes. However, what are the permissions that need to be granted for the token and what is the exact process for generating them?

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I'm getting this error once the action finishes running the tests.
Screen Shot 2021-06-16 at 12 04 26
This is the action file.

name: Coverage report

on: [pull_request]

jobs:
  test:
    name: Test coverage
    runs-on: ubuntu-latest
    timeout-minutes: 15

    env:
      NODE_ENV: test
      DB_NAME: api_test
      DB_USER: postgres
      DB_PASSWORD: postgres
      DB_HOST: postgres
      DB_PORT: 5432
      CI_JOB_NUMBER: 1

    container: node:10.0-stretch

    services:
      postgres:
        image: postgres:11.9-alpine
        env:
          POSTGRES_DB: api_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Restore cache
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: node-modules-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            node-modules-

      - name: Install dependencies
        run: npm install

      - name: Run migrations
        run: npm run db:migrate

      - name: Run coverage report
        uses: artiomtr/jest-coverage-report-action@master
        with:
          test_script: PORT=5000 NODE_ENV=test jest --runInBand --forceExit --detectOpenHandles --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"
          github_token: ${{ secrets.GITHUB_TOKEN }}

Is it possible specify npm and node version when using this action?

Getting the following error when running this action:

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for @: wanted: {"npm":"6.14.13","node":"14.16.0"} (current: {"node":"12.22.1","npm":"6.14.12"})
npm ERR! notsup Not compatible with your version of node/npm: @
npm ERR! notsup Not compatible with your version of node/npm: @
npm ERR! notsup Required: {"npm":"6.14.13","node":"14.16.0"}
npm ERR! notsup Actual:   {"npm":"6.14.12","node":"12.22.1"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /github/home/.npm/_logs/2021-05-19T17_02_44_732Z-debug.log
Error: The process '/usr/local/bin/npm' failed with exit code 1

In my package.json, I have the node and npm versions specified as 6.14.13 and 14.16.0.

"engines": {
    "npm": "6.14.13",
    "node": "14.16.0"
  },

Is it possible to specific the node and npm versions when using this action

Emojis not showing up in coverage report

Hi, using the GH action to print the coverage report I can't see the emojis/icons for -ok and -slightly more than threshold.
Not sure if this is only a problem I see but this is how it looks on Chrome and Firefox.

I'm using macOS Mojave Version 10.14.6.

Chrome
Screen Shot 2021-07-16 at 1 04 48 PM

Firefox
Screen Shot 2021-07-16 at 1 11 31 PM

Thanks!

Should action fail when some tests are failing?

Discussed in #94

Originally posted by ArtiomTr June 27, 2021

Continuation of #91

The original design of this action implies the following behavior:

  • Collecting coverage
  • Fail if no report.json found
  • If coverage threshold is specified, fail when total coverage is less than specified one

However, by #44 PR, new functionality was implemented: annotating on failed tests. With this check, it wouldn't be logical to complete the action successfully when the test fails.

This leads to irrational behavior. I would like to ask, would it be better if the action fails when the tests are failing? Or it should work as now?

Thank you in advance.

Action should fail when tests are failing.

failed-tests annotation check's status should not depend on tests. This means, that if failed-tests annotation check fails, some error occurred with code annotations.

Lines of code numbers do not match

Hi,

Lines of code that are posted via the plugin do not match the summary numbers that are produced via jest json-summary and the number seen in the terminal.

Screen Shot 2021-07-17 at 1 39 05 pm
Screen Shot 2021-07-17 at 1 39 24 pm

Edit: it occurs to me that the intention might be that these reporters might be different.
Please ignore this if that is the case.

Make annotation fail when tests are failing

Action should fail when tests are failing.

failed-tests annotation check's status should not depend on tests. This means, that if failed-tests annotation check fails, some error occurred with code annotations.

If you don't agree with this behavior, you can discuss it here -> #94

Make coverage annotation optional

Coverage annotations in the PR makes reviewing extremely difficult.
If there was an option to disable the annotation, that would be very helpful.

The dist files for v1.1 are still from v1.0

The bundled/built dist/index.js file still still attempts to git fetch ${branch} --depth=1 and npm ci in getRawCoverage.ts.

However, it looks like dist is up-to-date in master. So the tag just needs to be moved, or create a new v1.1.1 tag.

To move the tag

git tag --force v1.1
git push --force --tags

Cannot make it work with skip-step:all

It seems that the action cannot access coverage report when skipping all, this is the output:

Could not read report file located at report.json [Error: ENOENT: no such file or directory, open 'report.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'report.json'
}

My config:

name: Main

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      CI_JOB_NUMBER: 1
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 12.x
      - name: Install dependencies
        run: yarn bootstrap
      - name: Run tests
        run: yarn test-ci
      - name: Extract code coverage
        uses: ArtiomTr/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          skip-step: all
          threshold: 80
          package-manager: yarn
          annotations: coverage
"test-ci": "yarn jest --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\"",

Support multiple instances in one project

We have two separate package.json in our project (frontend and backend), and I would like to run code coverage for both for each Pull Request.

The minimum requirement would be a configurable name that is included in the comment tag, so that the two instances don't override each other's comment.

Problems running only collect coverage

Hi,
I'm trying to use our action just to collect my report and comment on github that information, but I can't run successfully.

My action:

      - name: Step 08 - Run Tests & Collect Coverage
        run: |
          echo “PATH_WAZUH-APP=$GITHUB_WORKSPACE/kibana/plugins/wazuh-kibana-app/” >> $GITHUB_ENV
          cd ./kibana/plugins/wazuh-kibana-app
          ls -la
          echo $GITHUB_WORKSPACE/kibana/plugins/wazuh-kibana-app/
          yarn run test:jest --silent --ci --testLocationInResults --colors --coverage --json --outputFile=report.json

      - name: Step 09 - Comment coverage
        uses: artiomtr/[email protected]
        with:
          working-directory: ${{ env.PATH_WAZUH-APP }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
          skip-step: all

Error result:

Run artiomtr/[email protected]
  with:
    github-token: ***
    skip-step: all
    test-script: npx jest --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"
    icons: emoji
    annotations: all
    package-manager: npm
  env:
    “PATH_WAZUH-APP: /home/runner/work/wazuh-kibana-app/wazuh-kibana-app/kibana/plugins/wazuh-kibana-app/”
Could not read report file located at report.json [Error: ENOENT: no such file or directory, open 'report.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'report.json'
}
/usr/bin/git fetch --all --depth=1
fatal: not a git repository (or any of the parent directories): .git
Error fetching git repository Error: The process '/usr/bin/git' failed with exit code 128
    at f._setResult (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:11470)
    at f.CheckComplete (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:10900)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:9944)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:659:12)
/usr/bin/git checkout -f 4.3-7.10
fatal: not a git repository (or any of the parent directories): .git
Error: The process '/usr/bin/git' failed with exit code 128


Here my action.yml

"Tests' annotations" check cannot be set as required in GitHub configuration

The "Tests' annotations" check cannot be set as required in the "Branch protection rules" in GitHub because of the simple quote character.
When trying to set it as a required check, this error pops up:
Screenshot 2021-07-05 at 9 19 19 AM

Steps to reproduce:

  • go in the settings of a repo using jest-coverage-report-action
  • create a branch protection rule
  • check the "require status checks to pass before merging"
  • try to search for the "Tests' annotations" check in the search box and select it
  • nothing happens, "Tests' annotations" is not added to the list, and you can see the error above in the console

I think the right way to go around this issue would be to remove the quote from the check name, but it would lead to a breaking change (not sure anyone anywhere used the check name for any purpose though, so it might be an inconsequential breaking change).

Proposed fix:
src/format/strings.json +43
"failedTestsCheckName": "Tests' annotations (🧪 jest-coverage-report-action)", => "failedTestsCheckName": "Tests annotations (🧪 jest-coverage-report-action)",

I can make a PR with this change if that's fine with y'all.

Somewhat linked to #98, as having the test step fail when testing results in an error would work around this issue.

Passing coverage but action not completing

I'm very excited to incorporate this tool into my workflow!

I've customized the testing script:

name: Testing and Linting

on:
  pull_request:

jobs:
  coverage:
        runs-on: ubuntu-latest
        env:
            CI_JOB_NUMBER: 1
        steps:
            - uses: actions/checkout@v1
            - uses: artiomtr/[email protected]
              with:
                  github_token: ${{ secrets.GITHUB_TOKEN }}
                  test_script: npm run test -- --coverage --coverageReporters="text" --coverageReporters="text-summary" --watchAll
                  threshold: 90
  test:
    name: Linting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Install
        run: npm install
      - name: Linter
        run: npm run lint

and I see the coverage report in the logs passing the threshold

Github Actions Log

but the coverage action continues to run until I manually stop it. What I can I try to fully implement this tool?

Rename action's options

working_directory -> working-directory
test_script -> test-script
github-token -> github-token

Git fetch command fails, is there any way to improve it?

Hi.

I have been able to use this action to run tests successfully, but the git fetch command fails.
I think it's because I don't specify the remote branch name.
Is there any way to work around this?

Test execution failed with message: "The process '/usr/local/bin/npx' failed with exit code 1"
/usr/bin/git fetch develop --depth=1
fatal: 'develop' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Fetch failed The process '/usr/bin/git' failed with exit code 128
/usr/bin/git checkout -f develop
error: pathspec 'develop' did not match any file(s) known to git.
Error: The process '/usr/bin/git' failed with exit code 1

If there is no workaround at this point, I would appreciate it if you could fix it.
Or can I submit a pull request?

Thanks.

changedSince=master is not working

using the following command

"test:coverage": "node scripts/test.js --watchAll=\"false\" --ci --silent --testLocationInResults --coverage --changedSince=master --coverageReporters=\"text\" --coverageReporters=\"text-summary\" --json --outputFile=\"report.json\"",

Not able to set a working-directory

I was trying this action out but it keeps failing to find the package.json file in /github/workspace directory
Screenshot 2021-03-20 at 6 46 48 PM

my test-script is

"test:unit": npx jest -b --colors --no-cache --silent --coverage --coverageReporters='text' --coverageReporters='text-summary'

Custom test script error: command "jest" not found

Hello, I can't make my custom script working.

It looks like the dev dependencies are not installed. But before switching to this config I was running yarn jest in my own step (using skip-step: all) and it was working ok.

Action logs:

Run ArtiomTr/[email protected]
/usr/local/bin/yarn test-ci:coverage
yarn run v1.22.10
$ yarn jest --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"
error Command "jest" not found. Did you mean "test"?
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Test execution failed with error: Error: The process '/usr/local/bin/yarn' failed with exit code 1
    at f._setResult (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0-rc.2/dist/index.js:2:11470)
    at f.CheckComplete (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0-rc.2/dist/index.js:2:10900)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2.0-rc.2/dist/index.js:2:9944)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Could not read report file located at report.json [Error: ENOENT: no such file or directory, open 'report.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'report.json'
}

The job:

test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 12.x
      - name: Install dependencies
        run: yarn bootstrap
      - name: Run tests
        uses: ArtiomTr/[email protected]
        with:
          test-script: yarn test-ci:coverage
          github-token: ${{ secrets.GITHUB_TOKEN }}
          skip-step: install

Getting error after running the test script - Error: ❌ Output of test script has invalid format. Check [documentation](https://github.com/ArtiomTr/jest-coverage-report-action#jest-coverage-report-) for more details.

This is how I've implemented my workflow file -

on: pull_request

jobs:
  test-coverage:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Comment with Test Coverage
        uses: artiomtr/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          test_script: npm run test --silent --ci --coverage --json --coverageReporters="text" --coverageReporters="text-summary" --outputFile=\"report.json\"

Request: display base branch values as tooltip

In the PR reports, it would be nice to see the exact base branch values as tooltips when hovering over the head branch values.

Howering over the percentage would show the percentage from the base branch run, etc.

Error: The process '/usr/bin/git' failed with exit code 1

Hi ArtiomTr,

very nice action! It does run the tests without problems. However, it doesn't complete any run successfully. Here is the error log:

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.197 s
/usr/bin/git fetch --all --depth=1
13:54:31.022129 git.c:371               trace: built-in: git 'fetch' '--all' '--depth=1'
13:54:31.037398 run-command.c:350       trace: run_command: 'fetch' '--append' 'origin'
Fetching origin
13:54:31.039069 exec_cmd.c:118          trace: exec: 'git' 'fetch' '--append' 'origin'
13:54:31.240141 git.c:371               trace: built-in: git 'fetch' '--append' 'origin'
13:54:31.246548 run-command.c:350       trace: run_command: 'git-remote-https' 'origin' 'https://github.com/microsoft/continuous-service'
* Couldn't find host github.com in the .netrc file; using defaults
*   Trying 140.82.114.3...
* TCP_NODELAY set
* Connected to github.com (140.82.114.3) port 443 (#0)
* found 137 certificates in /etc/ssl/certs/ca-certificates.crt
* found 548 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_ECDSA_AES_128_GCM_SHA256
* 	 server certificate verification OK
* 	 server certificate status verification SKIPPED
* 	 common name: github.com (matched)
* 	 server certificate expiration date OK
* 	 server certificate activation date OK
* 	 certificate public key: EC/ECDSA
* 	 certificate version: #3
* 	 subject: C=US,ST=California,L=San Francisco,O=GitHub\, Inc.,CN=github.com
* 	 start date: Thu, 25 Mar 2021 00:00:00 GMT
* 	 expire date: Wed, 30 Mar 2022 23:59:59 GMT
* 	 issuer: C=US,O=DigiCert\, Inc.,CN=DigiCert High Assurance TLS Hybrid ECC SHA256 2020 CA1
* 	 compression: NULL
* ALPN, server accepted to use http/1.1
> GET /microsoft/continuous-service/info/refs?service=git-upload-pack HTTP/1.1
Host: github.com
User-Agent: git/2.11.0
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: GitHub Babel 2.0
< Content-Type: text/plain
< Content-Security-Policy: default-src 'none'; sandbox
< Content-Length: 21
< www-authenticate: Basic realm="GitHub"
< X-GitHub-Request-Id: 06C0:4B0C:1AA940B:29A18A5:60C75F98
< X-Frame-Options: DENY
< 
* Curl_http_done: called premature == 0
* Connection #0 to host github.com left intact
fatal: could not read Username for 'https://github.com': No such device or address
error: Could not fetch origin
13:54:32.543139 run-command.c:350       trace: run_command: 'gc' '--auto'
13:54:32.543498 exec_cmd.c:118          trace: exec: 'git' 'gc' '--auto'
13:54:32.544993 git.c:371               trace: built-in: git 'gc' '--auto'
Error: The process '/usr/bin/git' failed with exit code 1

the actions yml looks like this

name: 'code coverage'
on:
    pull_request:
        branches:
            - main
jobs:
    coverage:
        runs-on: ubuntu-latest
        env:
            CI_JOB_NUMBER: 1
            GIT_TRACE: 1
            GIT_CURL_VERBOSE: 1
        steps:
            - uses: actions/checkout@v1
            - uses: artiomtr/[email protected]
              with:
                  github_token: ${{ secrets.GITHUB_TOKEN }}
                  threshold: 80 # value in percents

Are you familiar with the issue?

Create custom reporter

Custom coverage reporter should access more information about coverage.

This issue required for solving #10 and #20

Option to add failed tests as comment

When PRs are huge, finding annotations is a chore.
If a summary of failed tests are added as a comment like coverage, it would be much easier to review.

I can raise the PR if the feature can be added.

Could not read report file located at report.json

Hello @ArtiomTr , I tried to use the Jest github-action as it is in the instructions. However, I get the following error every time. Can you please tell me what's going wrong here?

Github Actions Configuration:

name: 'coverage'
on:
    pull_request:
        branches:
            - master
jobs:
    coverage:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v1
            - uses: artiomtr/[email protected]
              with:
                  github-token: ${{ secrets.GITHUB_TOKEN }}
                  package-manager: yarn
                  test-script: yarn run test -- --silent --ci --coverage --coverageReporters="text" --coverageReporters="text-summary"
                  #   threshold: 80 

Github Action Error Screenshot:
image

I can't seem to figure out what might be the issue. The tests as you can see are completed correctly the final step just fails which causes the entire action to fail even though all tests have passed. Originally I had just yarn run test in the test-script as that is what I would use normally but that doesn't work either

Feat: add debug option to see why github action is failing

All my tests are passing, but I am still getting a failed error with this github action. Is there a way to pass a debug flag to see what is going on?

Maybe something like https://jestjs.io/docs/cli#--debug

=============================== Coverage summary ===============================
Statements   : 80.17% ( 1314/1639 )
Branches     : 70.6% ( 437/619 )
Functions    : 79% ( 365/462 )
Lines        : 79.08% ( 1187/1501 )
================================================================================

Test Suites: 1 skipped, 53 passed, 53 of 54 total
Tests:       6 skipped, 202 passed, 208 total
Snapshots:   4 passed, 4 total
Time:        30.707 s, estimated 55 s
Test execution failed with message: "The process '/usr/local/bin/npx' failed with exit code 1"
Error: ❌ The test suite failed. Please, check the console output for more details.

Unexpected token in tests

When I run the action, and pass the tests, I have the next:

FAIL src/app/main/shared/components/generic-selector/generic-selector-dialog/generic-selector-dialog.component.spec.ts
● Test suite failed to run

SyntaxError: /github/workspace/frontend/src/app/main/shared/components/generic-selector/generic-selector-dialog/generic-selector-dialog.component.spec.ts: Missing semicolon. (15:15)

  13 |
  14 | describe('GenericSelectorDialogComponent', () => {
> 15 |   let component: GenericSelectorDialogComponent;

Here is not neccessary a semicolon, why is a fail?, and this happens in all tests

npm i fails - duplicate in path

Run artiomtr/[email protected]
  with:
    github-token: ***
    annotations: failed-tests
    test-script: npx jest --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"
    icons: emoji
    package-manager: npm
    skip-step: none
  env:
    NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
    NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
/opt/hostedtoolcache/node/14.17.0/x64/bin/npm install
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/styled-components-51686fc4/dist/styled-components-macro.cjs.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/styled-components-51686fc4/dist/styled-components-macro.cjs.js.map'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/styled-components-51686fc4/dist/styled-components-macro.esm.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/styled-components-51686fc4/dist/styled-components-macro.esm.js.map'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/react-c9bd9316/cjs/react-jsx-runtime.production.min.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/my-app/my-app/node_modules/.staging/styled-components-51686fc4/dist/styled-components.browser.cjs.js'
...

I suspect it has something to do with dup in path - my-app appears twice /home/runner/work/my-app/my-app/node_modules

With skip-step: install, I get

Error: The process '/opt/hostedtoolcache/node/14.17.0/x64/bin/npx' failed with exit code 1
    at f._setResult (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:11470)
    at f.CheckComplete (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:10900)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/artiomtr/jest-coverage-report-action/v2.0-rc.1/dist/index.js:2:9944)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

The only way to make it work is if I install, test on my own but then I lose out on annotations.

  run_tests:
    name: Tests
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: '14.x'
          always-auth: true
          registry-url: https://npm.pkg.github.com
          scope: '@acme-corp'

      - name: Cache node_modules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

      - name: install deps
         run: npm install
         env:
           NODE_AUTH_TOKEN: ${{secrets.BOT_TOKEN}}

       - name: Run Tests & Collect Coverage
         run: npx jest --silent --ci --coverage --testLocationInResults --json --outputFile="report.json"

      - name: Report Coverage
        uses: artiomtr/[email protected]
        with:
          github-token: ${{ secrets.GHPR_TOKEN }}
          skip-step: all
          annotations: failed-tests

Using a GHPR_TOKEN as I need to read private packages from github package registry.

Coverage report is running but getting a git issue "could not read Username for https://github.com"

As you can see in the attached screen shot, the coverage report seems to run just fine. My best guess is that it's failing when trying to switch to the main branch for the comparison report.

For what it's worth, this is a new project in the repo so the entire folder doesn't exist in the head branch. Not sure if that could cause it.

image

My action YAML is pretty basic:

name: Deferred Click Logger Lambda Tests
on:
  push:
    branches:
      - main
      - qa
  pull_request:
    branches:
      - main
    paths:
      - 'lambda/ClickLogger/**'

jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: artiomtr/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          working_directory: lambda/ClickLogger
          #   threshold: 80 # optional parameter
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: test
        run: npm ci && npm run test

Not running the test if the coverage file already exists?

Nice action you got there, but I was wondering if it would be possible to add an option to not run the test if I know I ran them earlier and that the coverages files are already present.

An easy way to make my CI faster :)

Thanks!

Coverage run not respecting yarn.lock

Hi, wanted to start by thanking you for this awesome action, its great 👍🏻

Issue: We use yarn.lock in our codebase to lock dependencies in place, due to which our action for test passed, but this action for coverage failed as it pulled in the latest package hence failing our dependent snapshots.

Can we please make some changes so that this action respects the yarn.lock, OR maybe have configuration in a way where we as a user after checkout, do the regular node setup, and yarn install, and this package only runs coverage. Thoughts, suggestions?

proposal: Identify Coverage Added in PR

Hey there!

We just started using this action - and so far it has been working really well for us. So thank you so much for taking the time to develop it for the community to use! I had a feature request in mind that I was wondering if we could iron out and get into the backlog (if you saw value in it).

We think it would be really great to see some way of % difference of coverage added in any given PR. Since the diff is already being taken from the base branch, theoretically this would just be adding another value for the action to comment back with. But I'm not sure how to avoid overcrowding or produce the right information architecture. Either way - we'd really like some way to give props to those who take an active role in making the code base more tested.

What are your thoughts on how this may provide value in your action?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.