intellij icon indicating copy to clipboard operation
intellij copied to clipboard

fix(test-go): add test_env to output all test results

Open JamyDev opened this issue 3 years ago • 1 comments

Checklist

  • [x] I have filed an issue about this change and discussed potential changes with the maintainers.
  • [N/A see note below] I have received the approval from the maintainers to make this change.
  • [x] This is not a stylistic, refactoring, or cleanup change.

Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See the Contributions section in the README for more details.

Discussion thread for this change

Issue number: https://github.com/bazelbuild/intellij/issues/2989

Description of this change

Root cause of the issue

By default Bazel running Go flavor tests doesn't output successful tests to the test.xml file. Which is what causes the "No tests were found" message.

Solution

To make Go log successful tests as well, we need to set -test.v (verbose test output) on the test runner. Bazel Rules Go offers an environment variable (GO_TEST_WRAP_TESTV=1) to set -test.v on the test runner.

Changes explained

Since this is Go specific, I wanted to add the test_env variable to GoTestContextProvider, however the TestContext.Builder doesn't offer that as a feature. So I added a new BlazeFlagsModification as well as added an addTestEnv method on Builder.

Note on checklist

I made this change before I read about the approval to make change thing. Hope we can have the discussion here instead!

JamyDev avatar Oct 22 '21 16:10 JamyDev

Hello @JamyDev, Thank you for contributing on the above PR. Could you please rebase as mentioned here and help us in submitting it.

sgowroji avatar Sep 22 '22 03:09 sgowroji

Sorry for the long cycle time. Rebased! @sgowroji

JamyDev avatar Nov 01 '22 23:11 JamyDev

Hi @sgowroji @tpasternak, do you think this could be reviewed/merged soon? We'd love to start using it.

kriscfoster avatar Nov 22 '22 17:11 kriscfoster