gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
1.99k stars 118 forks source link

Implemented combine coverprofile in the case of rerun failed #387

Open yihuaf opened 5 months ago

yihuaf commented 5 months ago

Fix #274

As discussed in #274, when gotestsum rerun failed test cases, the coverprofile gets overridden by the each calls to the underlying go test, causing coverprofile to per in correct.

I tested the code with the repros provided in #274: https://github.com/neiser/gotestsum-rerun-dependent-subtests/tree/master

The code is just a proof of concept. If the general approach is acceptable, then I will go ahead and clean up the PR with necessary unit tests and comments.

The general approach taken in this PR:

yihuaf commented 5 months ago

Looks like test-windows is broken unrelated to my change. I tried tip of the tree and the test still fails.

=== Failed
=== FAIL: cmd TestE2E_RerunFails/first_run_has_errors,_abort_rerun (0.39s)
    main_e2e_test.go:69: assertion failed: 
        --- expected
        +++ actual
        @@ -1,6 +1,11 @@
        +FAIL testjson/internal/broken
        +
        +=== Failed
        +=== FAIL: testjson/internal/broken 
        +FAIL   gotest.tools/gotestsum/testjson/internal/broken [build failed]

         === Errors
         ../testjson/internal/broken/broken.go:5:21: undefined: somepackage

        -DONE 0 tests, 1 error
        +DONE 0 tests, 1 failure, 1 error
gaby commented 4 months ago

@dnephin I was trying to do a PR to update your dependencies but tests are failing locally with the same error posted by @yihuaf

yihuaf commented 4 months ago

@dnephin Please let me know if there is anything you would like me to follow up :)

yihuaf commented 3 months ago

@dnephin Let me know if there is anything else you would like me to fix :)

yihuaf commented 1 month ago

@dnephin Ping again :)