Why is `coverallsapp/github-action@v2` saying "Nothing to report" when I have a coverage directory generated by c8?

huangapple go评论46阅读模式
英文:

Why is `coverallsapp/github-action@v2` saying "Nothing to report" when I have a coverage directory generated by c8?

问题

I am running tests and collecting coverage with Vitest configured to use the c8 coverage library. This seems to be working because when the tests finish, I get a coverage report in the terminal and a directory named coverage is created with all sorts of files I can look at in a browser.

$ ls -la coverage/
total 712
drwxr-xr-x  14 shawn  staff     448 Apr 10 11:08 .
drwxr-xr-x  24 shawn  staff     768 Apr 10 11:23 ..
-rw-r--r--   1 shawn  staff    5394 Apr 10 11:08 base.css
-rw-r--r--   1 shawn  staff    2655 Apr 10 11:08 block-navigation.js
-rw-r--r--   1 shawn  staff  108109 Apr 10 11:08 clover.xml
-rw-r--r--   1 shawn  staff  190921 Apr 10 11:08 coverage-final.json
drwxr-xr-x   4 shawn  staff     128 Apr 10 11:08 examples
-rw-r--r--   1 shawn  staff     445 Apr 10 11:08 favicon.png
-rw-r--r--   1 shawn  staff    5802 Apr 10 11:08 index.html
-rw-r--r--   1 shawn  staff     676 Apr 10 11:08 prettify.css
-rw-r--r--   1 shawn  staff   17590 Apr 10 11:08 prettify.js
-rw-r--r--   1 shawn  staff     138 Apr 10 11:08 sort-arrow-sprite.png
-rw-r--r--   1 shawn  staff    6181 Apr 10 11:08 sorter.js
drwxr-xr-x  11 shawn  staff     352 Apr 10 11:08 src

My next step is to send this coverage information along to Coveralls to get a coverage badge for my README. For this part, I'm using the GitHub Action provided by Coveralls for this use-case: coverallsapp/github-action@v2.

This doesn't work, however; it seems the action is not finding the coverage report since it says "Nothing to report."

Here are the relevant parts of the deployment workflow:

[…]
  test:
    […]
    steps:
      […]
      - name: Test
        run: npm test
        env: […]

      - name: Report Coveralls
        uses: coverallsapp/github-action@v2

The npm test part creates the coverage directory (it basically just runs vitest run --coverage).

So why is Coveralls not finding the coverage report? Should I be configuring c8 to produce a different format of output? Do I need extra configuration when calling coverallsapp/github-action@v2? Should I be using istanbul instead of c8, or perhaps something else? Should I be using CodeDov instead of Coveralls, or perhaps something else?

英文:

I am running tests and collecting coverage with Vitest configured to use the c8 coverage library. This seems to be working because when the tests finish, I get a coverage report in the terminal and a directory named coverage is created with all sorts of files I can look at in a browser:

$ ls -la coverage/
total 712
drwxr-xr-x  14 shawn  staff     448 Apr 10 11:08 .
drwxr-xr-x  24 shawn  staff     768 Apr 10 11:23 ..
-rw-r--r--   1 shawn  staff    5394 Apr 10 11:08 base.css
-rw-r--r--   1 shawn  staff    2655 Apr 10 11:08 block-navigation.js
-rw-r--r--   1 shawn  staff  108109 Apr 10 11:08 clover.xml
-rw-r--r--   1 shawn  staff  190921 Apr 10 11:08 coverage-final.json
drwxr-xr-x   4 shawn  staff     128 Apr 10 11:08 examples
-rw-r--r--   1 shawn  staff     445 Apr 10 11:08 favicon.png
-rw-r--r--   1 shawn  staff    5802 Apr 10 11:08 index.html
-rw-r--r--   1 shawn  staff     676 Apr 10 11:08 prettify.css
-rw-r--r--   1 shawn  staff   17590 Apr 10 11:08 prettify.js
-rw-r--r--   1 shawn  staff     138 Apr 10 11:08 sort-arrow-sprite.png
-rw-r--r--   1 shawn  staff    6181 Apr 10 11:08 sorter.js
drwxr-xr-x  11 shawn  staff     352 Apr 10 11:08 src

My next step is to send this coverage information along to Coveralls to get a coverage badge for my README. For this part, I'm using the GitHub Action provided by Coveralls for this use-case: coverallsapp/github-action@v2

This doesn't work, however: it seems the action is not finding the coverage report since it says "Nothing to report".

Here are the relevant parts of the deployment workflow:

[…]
  test:
    […]
    steps:
      […]
      - name: Test
        run: npm test
        env: […]

      - name: Report Coveralls
        uses: coverallsapp/github-action@v2

The npm test part creates the coverage directory (it basically just runs vitest run --coverage).

So why is Coveralls not finding the coverage report? Should I be configuring c8 to produce a different format of output? Do I need extra configuration when calling coverallsapp/github-action@v2? Should I be using istanbul instead of c8, or perhaps something else? Should I be using CodeDov instead of Coveralls, or perhaps something else?

答案1

得分: 0

仅翻译代码部分:

  • Nothing in your question tells the action wouldn't work perfectly fine.
  • Only the coverage data is not found. You need to provide the correct location to the action otherwise it can't work.
  • Find this explained in the Coveralls Github Action read-me.
  • You have to use at least one coverage format that is compatible with the coverage reporter used by that Coveralls Github Action.
  • Showing the HTML coverage directory and insisting in your question text is not enough to actually make it properly configured.
  • As you haven't asked anything more specifically, this is the answer.
  • Encouraging you to do even more wild guesses next to those you outline already in your question also does not look useful to me.
  • My suggestion instead is to focus on the clover.xml file and tell the Coveralls action where to find it. Technically, you can use any other supported format, too.
  • Correction: The Coveralls Github Action does not yet support clover.xml format.
英文:

Nothing in your question tells the action wouldn't work perfectly fine.

Only the coverage data is not found. You need to provide the correct location to the action otherwise it can't work.

Find this explained in the Coveralls Github Action read-me.

You have to use at least one coverage format that is compatible with the coverage reporter used by that Coveralls Github Action.

Showing the HTML coverage directory and insisting in your question text is not enough to actually make it properly configured.

As you haven't asked anything more specifically, this is the answer.

Encouraging you to do even more wild guesses next to those you outline already in your question also does not look useful to me.

My suggestion instead is to focus on the clover.xml file and tell the Coveralls action where to find it. Technically, you can use any other supported format, too.

Correction: The Coveralls Github Action does not yet support clover.xml format.

huangapple
  • 本文由 发表于 2023年4月10日 23:46:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978550.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定