actions-rs/grcov

Wrong coverage using the example Github Workflows in the documentaiton

Opened this issue · 1 comments

Do the checklist before filing an issue:

Description

Using a Github Workflow like the one suggested in the documentation, macro invocation is considered as not covered by tests, although it is.

Workflow code

  test:
    name: Test
    runs-on: ubuntu-latest
  
    steps:
      - uses: actions/checkout@v3
        with:
          lfs: true

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
   
      - uses: actions-rs/cargo@v1
        with:
          command: test        
        args: --all-features
        env:
          CARGO_INCREMENTAL: '0'
          RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage'
          RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage'
      
      - uses: actions-rs/grcov@v0.1
        id: coverage
        name: Generate code coverage

      - name: Upload to codecov.io
        uses: codecov/codecov-action@v3
        with:
          files: ${{ steps.coverage.outputs.report }}
          token: ${{ secrets.CODECOV_TOKEN }}

Expected behavior

This code of the thiserror macro be covered, instead it is not:

#[derive(Error, Debug, PartialEq, Eq)]
pub enum EncodingFormatParsingError {
    #[error("Unexpected encoding {0}")] // line not covered
    UnexpectedEncoding(String),
}

See #141 if Rust stable works better for you