question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Explicit output format always outputs JSON but only on one machine

See original GitHub issue

Issue Description

I am currently going open source with one of my projects and using/learning GitHub actions for the first time.
I am coming from Azure DevOps with a lot of experience with pipelines as well. During this process, I am at the point of generating code coverage reports that can be consumed by either Coveralls or CodeCov.

Once I got it all set up and building using my own hosted agents on my build server, I noticed that the report being generated is in the JSON format even though I explicitly used the dotnet test command to use the lcov format. I tried other formats as well but no matter what format I use, it generates it in JSON format.

The next thing I tried is I manually tried to run the dotnet test command on the project in the build agent itself on my build server to see if I could get it work properly and of course it did not work, because I did not have the .NET SDK 5.0.x installed. So I manually installed the SDK so I could do some troubleshooting and attempted the command again. This time the command of course ran successfully, but I still had the same behavior as the agent itself and the coverage report was still in JSON format even though my command was explicitly using the lcov format.

At this point I tried running the dotnet test command on my local dev machine and low and behold, it works just fine with no issue.

I also tried this using a GitHub Hosted server instead of my server, and it still does not work.

Everything points to some kind of difference from the machines and that I am doing everything correctly.
Any guidance or help on this issue would be greatly appreciated. 🙂

Commands Used/Attempted:

dotnet test MyProject.csproj /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOuputFormat=lcov and dotnet test MyProject.csproj /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOuputFormat=cobertura


Workflow YAML Being Used:

name: .NET

on:
  workflow_dispatch:
    inputs:
      name:
        description: "Manual Run"
        required: true
        
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  Build_Project:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET 5.0.x
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 5.0.x
    - name: Restore Dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --no-restore
  
  Run_Unit_Tests:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET 5.0.x
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 5.0.x
      - name: Restore Dependencies
        run: dotnet restore
      - name: Execute Unit Tests
        run: dotnet test "${{ github.workspace }}\\Testing\\CASLTests\\CASLTests.csproj" /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOuputFormat=lcov
      - name: Publish Code Coverage Results
        uses: coverallsapp/github-action@v1.1.2
        with:
          github-token: ${{ secrets.COVERALLS_TOKEN }}
          path-to-lcov: "${{ github.workspace }}\\Testing\\CASLTests\\TestResults"

Local Machine Environment

  • Windows 10 20H2 (OS Build 19042.985)
  • .NET SDK 5.0.300 (x64) from Visual Studio

Personal Build Server Environment

  • Windows 10 20H2 (OS Build 19042.985)
  • Do not have Visual Studio or any **.NET SDK’s ** installed
    • Not required. I use the setup-dotnet@v1 GitHub action

GitHub Hosted Environment

  • I use the latest windows

Steps to reproduce

I suppose you could setup an agent on your local dev machine, setup one using the GitHub hosted server using windows-latest and then run the dotnet test command on the dev machine pointed to the repo of the project.

Expected Behavior

When running the dotnet test command with the proper code coverage parameters, the expected output format will be produced when it is a GitHub hosted server, a personal machine with a setup agent, or simply from the project on a local dev machine.

Actual Behavior

  1. Generated output when running dotnet test command for project on local dev machine works just fine
  2. Generated output when running dotnet test command for project on personal build server with agent only generates JSON format
  3. Generated output when running dotnet test command using GitHub Hosted server only generates JSON format

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
daveMuellercommented, Dec 22, 2022

@artoxian @jimdeane, the issue was fixed by the microsoft guys with sdk 7.0.101 that was released last week https://github.com/microsoft/vstest/issues/4014. I just checked it with a repro from another related issue and it works fine. Please give it a try again.

0reactions
daveMuellercommented, Apr 10, 2023

I’m closing this as the external issue was fixed and already released. Feel free to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can GPT be forced to only output e.g. code and JSON?
I've struggled to force GPT to always respond JSON format. Adding the `[no prose][Output only JSON]` helped a little bit but still there ......
Read more >
Format Query Results as JSON with FOR JSON - SQL Server
Format query results as JSON, or export data from SQL Server as JSON, by adding the FOR JSON clause to a SELECT statement....
Read more >
Internals: JSON Output Format | Terraform
The JSON output format consists of the following objects and sub-objects: State Representation — The complete top-level object returned by terraform show -json...
Read more >
How can I pretty-print JSON in a shell script?
I wrote a tool that has one of the best "smart whitespace" formatters available. It produces more readable and less verbose output than...
Read more >
Set the AWS CLI output format
JSON output format ​​ JSON is the default output format of the AWS CLI. Most programming languages can easily decode JSON strings using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found