Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execution time of tests is not included when using input from --raw-command #432

Open
kyoncal opened this issue Aug 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@kyoncal
Copy link

kyoncal commented Aug 29, 2024

Hi,

We run a somewhat involved nightly test set up and use want to use gotestsum to generate coverage reports. We've been running into an issue where the execution time of the test is not included in the report. We run something similar to this:

$go test >  test.txt 
$(cat test.txt |  go tool test2json) > test.json 
$cat test.json | gotestsum --junitfile report.xml --raw-command -- cat

test.json includes the execution time of the tests.

@dnephin dnephin added the enhancement New feature or request label Sep 5, 2024
@dnephin
Copy link
Member

dnephin commented Sep 5, 2024

Thank you for raising this issue! Currently the time is based on runtime of the gotestsum command.

We could add a flag to use the timestamps in the json instead of wall clock time for cases like this. I think that would be a great addition.

As a workaround you could use run the tests with gotestsum --junitfile report.xml --jsonfile test.json possibly with --raw-command if you have a complicated command to run. That way you'll get the correct runtime and still get the JSON output to a file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants