"There was an error processing coverage reports."

I am generating coverage reports for a Swift project using Xcode on Travis CI. The logs from the Codecov bash uploader indicate that the coverage reports have been found and uploaded successfully, but the resulting Codecov report simply says “There was an error processing coverage reports.” There is no indication what the error was, or how I might be able to fix it.

Links

After a lot of experimentation, I’ve figured out the underlying issue here: Codecov apparently can’t handle processing a coverage file for a target with only one source file. Using the -d option on the bash uploader, I dumped the coverage report being uploaded and discovered that a coverage report for a single-file target doesn’t contain file path headers that Codecov apparently needs.

For example, the coverage report for the single-file target looks like this:

<<<<<< network
# path=Identifier.framework.coverage.txt
    1|       |import struct Foundation.UUID
    2|       |
    3|       |public struct Identifier<T> {
    4|       |    public let uuid: UUID
    5|       |
    6|      1|    public init(uuid: UUID) {
    7|      1|        self.uuid = uuid
    8|      1|    }
    9|       |}

<<<<<< EOF

After adding another file to the target, the coverage report looks like this:

<<<<<< network
# path=Identifier.framework.coverage.txt
/Users/travis/build/mattrubin/Identifier/Sources/Identifier/Identifier.swift:
    1|       |import struct Foundation.UUID
    2|       |
    3|       |public struct Identifier<T> {
    4|       |    public let uuid: UUID
    5|       |
    6|      1|    public init(uuid: UUID) {
    7|      1|        self.uuid = uuid
    8|      1|    }
    9|       |}

/Users/travis/build/mattrubin/Identifier/Sources/Identifier/Test.swift:
    1|       |//
    2|       |//  Test.swift
    3|       |//  Identifier
    4|       |//
    5|       |//  Created by Matt Rubin on 3/29/19.
    6|       |//
    7|       |
    8|       |import Foundation
    9|       |
   10|       |let a = Identifier<Int>.init(uuid: UUID())
   11|       |
   12|      0|func doSomething() {
   13|      0|    print("!")
   14|      0|}

<<<<<< EOF

It is important to note that the second file must have lines with coverage data. A source file of just comments and constants doesn’t seem to fix the issue.

1 Like

Hey @mattrubin, you are absolutely right. We would need to have at least 2 files to follow the path. With a single file, this coverage output type doesn’t feel need to have path anywhere listed, so we don’t know where to look.

If you can file an issue with the coverage report project to write the file path to the file, we could start ingesting accordingly.