Skip to content

Makefile: Fix gotestsum failing to sync JSON file

When executing gotestsum we allow the user to specify that they want it to generate a JSON report via the TEST_JSON_REPORT variable. If not set, we ask gotestsum to not write the report by passing /dev/null.

This used to work with gotestsum v1.9.0 and before, but starting with v1.10.0 we now get an error:

ERROR Failed to sync JSON file: sync /dev/null: invalid argument

This is caused by db13c76 (Ensure jsonfile is flushed before running post-run-command, 2023-02-08), which started to flush the JSON file to disk.

Fix this issue by setting the JSON report path to the empty string by default. This will cause gotestsum to not even try to generate the report in the first place and thus neatly avoids the issue.

Merge request reports