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

Live output from --show-output-of-passing-tests #847

Open
jglick opened this issue Jan 19, 2024 · 1 comment
Open

Live output from --show-output-of-passing-tests #847

jglick opened this issue Jan 19, 2024 · 1 comment
Labels
Component: Bash Code Everything regarding the bash code Priority: Medium Wrong or misleading documentation, broken behavior with workaround Size: Large Changes across several files Type: Enhancement

Comments

@jglick
Copy link

jglick commented Jan 19, 2024

Is your feature request related to a problem? Please describe.
--show-output-of-passing-tests displays test output but only after the test completes. For tests which normally take many minutes to complete, or which appear to be hung, it is therefore difficult to tell what is going on. For example you may be checked a build log in a CI system to see if your new test is actually progressing or got stuck somewhere, but there is no way to see that until it completes (or times out, or is aborted).

Example:

@test "incremental output" {
  for x in 0 1 2 3 4 5 6 7 8 9
  do
    date
    sleep 3
  done
}

run as

$ bats --show-output-of-passing-tests x.sh
x.sh
 ✓ incremental output
   Fri Jan 19 04:45:42 PM EST 2024
   Fri Jan 19 04:45:45 PM EST 2024
   Fri Jan 19 04:45:48 PM EST 2024
   Fri Jan 19 04:45:51 PM EST 2024
   Fri Jan 19 04:45:54 PM EST 2024
   Fri Jan 19 04:45:57 PM EST 2024
   Fri Jan 19 04:46:00 PM EST 2024
   Fri Jan 19 04:46:03 PM EST 2024
   Fri Jan 19 04:46:06 PM EST 2024
   Fri Jan 19 04:46:09 PM EST 2024

1 test, 0 failures

initially prints only the test name; the full output only appears 30s later, all at once.

Describe the solution you'd like
Output should be streamed to the bats stdout/stderr as it is processed.

Describe alternatives you've considered
tail -f /tmp/bats-run-<something>/bats.<something>.out can be used as a workaround, but the filenames are unpredictable, and you cannot use a wildcard because there are two *.out files, one of which is empty AFAICT.

@jglick jglick added Priority: NeedsTriage Issue has not been vetted yet Type: Enhancement labels Jan 19, 2024
@martin-schulze-vireso martin-schulze-vireso added Priority: Medium Wrong or misleading documentation, broken behavior with workaround Component: Bash Code Everything regarding the bash code Size: Large Changes across several files and removed Priority: NeedsTriage Issue has not been vetted yet labels Jan 27, 2024
@martin-schulze-vireso
Copy link
Member

Implementing this would probably require deep changes, as the buffering happens on multiple levels.

Additionally, the formatters would need to be adapted, as their output is not consistent with this requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Bash Code Everything regarding the bash code Priority: Medium Wrong or misleading documentation, broken behavior with workaround Size: Large Changes across several files Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants