GoTestTools / gotestfmt

go test output for humans
The Unlicense
515 stars 9 forks source link

A hash character at the beginning of Output line causes test to be marked as failed #52

Closed JackuB closed 1 year ago

JackuB commented 1 year ago

I noticed that when an output line starts with #, it's matched against tokenizer regex for Packages:

https://github.com/GoTestTools/gotestfmt/blob/9eae5abc81d6d08f73268741ef4a8b97f29b60d8/tokenizer/tokenizer.go#L51-L62

This manifest as the output lines with # like:

{"Time":"2023-05-26T14:52:41.180732Z","Action":"output","Package":"code-intelligence.com/cifuzz/integration-tests/other","Test":"TestIntegration_Other_RunCoverage","Output":"# The FUZZ_TEST_CXXFLAGS and FUZZ_TEST_LDFLAGS environment variables\n"}
{"Time":"2023-05-26T14:52:41.185726Z","Action":"output","Package":"code-intelligence.com/cifuzz/integration-tests/other","Test":"TestIntegration_Other_RunCoverage","Output":"# are set by cifuzz when it executes the build command. Those must\n"}
{"Time":"2023-05-26T14:52:41.190079Z","Action":"output","Package":"code-intelligence.com/cifuzz/integration-tests/other","Test":"TestIntegration_Other_RunCoverage","Output":"# be passed to the compiler and linker (compiling and linking is\n"}
{"Time":"2023-05-26T14:52:41.194327Z","Action":"output","Package":"code-intelligence.com/cifuzz/integration-tests/other","Test":"TestIntegration_Other_RunCoverage","Output":"# done in a single invocation here, so we pass both to XX here).\n"}

are printed instead of the package/test name and exit code is non-zero:

Screenshot 2023-05-29 at 15 29 19

-

This PR matches the "action" regex only against non-JSON lines.

ghost commented 1 year ago

@engelmi I've reviewed these, look good, could you take a look too please?

engelmi commented 1 year ago

@engelmi I've reviewed these, look good, could you take a look too please?

Looks good to me, too :heavy_check_mark: