Open adhusson opened 2 years ago
What would you use the JSON output for? Out of curiosity.
Parse and format for the CI, create test summaries (e.g. this from test-reporter).
I think you can get print+pipe with tee
Thanks, yes it would help to print either text or JSON both on stdout and a file, but to get text to stdout + JSON to a file I think you need something like a --json-file
argument.
this is, unfortunately, a bit unambiguous because then we can't really write to file OR print to stdout
you can print and write with --json | tee out.json
Hey, what is the status on this? I also need the feature for my project, to have a script that outputs the original stdout (human-readable) for the user but also get the json data for processing.
Component
Forge
Describe the feature you would like
When running tests in a CI, it is useful to both show the human-readable output on stdout and write a JSON file to be processed at later stages by the CI.
Right now, the only way to output both is either 1) to run
forge test
twice, or 2) to runforge test --json | myProcessingTool
, wheremyProcessingTool
writes a JSON file and format the JSON back to human-readable output.With
forge test --json-file path/to/file
you would get both outputs.