Skip to content

Tests when ran outside of repo #15

Open
@ThinkChaos

Description

@ThinkChaos

Hi,

Thanks for the tool, I'm trying to use it to get coverage reports in my GH Actions.
I'm building the binary myself using Nix which builds it fine, and then runs the tests. The way it fetches the sources is not a full clone, but just a "download as zip".
This causes the tests to fail since getCoverallsSourceFileName ends up returning an absolute path:

--- FAIL: TestParseCoverage (0.01s)
    main_test.go:66:
                Error Trace:    main_test.go:66
                Error:          Not equal:
                                expected: "main.go"
                                actual  : "/build/source/main.go"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -main.go
                                +/build/source/main.go
                Test:           TestParseCoverage
--- FAIL: TestConvertCoverage (0.00s)
    main_test.go:102:
                Error Trace:    main_test.go:102
                Error:          Not equal:
                                expected: "TN:\nSF:main.go\nDA:6,1\nDA:7,1\nDA:8,1\nDA:9,0\nDA:10,2\nDA:11,2\nLF:6\nLH:5\nend_of_record\n"
                                actual  : "TN:\nSF:/build/source/main.go\nDA:6,1\nDA:7,1\nDA:8,1\nDA:9,0\nDA:10,2\nDA:11,2\nLF:6\nLH:5\nend_of_record\n"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,3 +1,3 @@
                                 TN:
                                -SF:main.go
                                +SF:/build/source/main.go
                                 DA:6,1
                Test:           TestConvertCoverage
--- FAIL: TestPathResolverFunc (0.00s)
    main_test.go:110:
                Error Trace:    main_test.go:110
                Error:          Not equal:
                                expected: "main.go"
                                actual  : "/build/source/main.go"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1 +1 @@
                                -main.go
                                +/build/source/main.go
                Test:           TestPathResolverFunc
FAIL
FAIL    github.com/jandelgado/gcov2lcov 0.018s
FAIL

I can workaround this by skipping the tests run, but thought I'd report it here :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions