Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

add --log functionality #123

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

aerickson
Copy link

a continuation of work done in lzap@9f6cc69

Please let me know if you'd like this squashed.

Thanks,
Andy

Andrew Erickson added 8 commits September 10, 2015 01:08
- TODO: add an option that controls this
- why: sometimes the first command will error and old logging
    method masked the error message.
- downside: no output will still show a blank line
  - do a chomp?
  - still doesn't get rid of headers if there's no output
@aerickson
Copy link
Author

@sstephenson and @lzap, any thoughts?

Thanks,
Andy

@aerickson
Copy link
Author

An example of the output is below.

test.bats

#!/usr/bin/env bash

@test "Test exit 128" {
    run bash -c "echo 'fat'"
    run bash -c "echo ''"
    run bash -c "echo ''"
    run bash -c "echo 'cat'"
    # [ "$status" -eq 128 ]
}

output in /tmp/bats.log from running bats --log test.bats

[74562] starting 'Test exit 128'
[74562] <<< begin output >>>
fat
cat
[74562] <<< end output >>>
[74562] ok 'Test exit 128'

/tmp/bats.log output from running ./bin/bats ./test/fixtures/bats/failing.bats --log

[20035] starting 'a failing test'
[20035] <<< begin output >>>
[20035] <<< end output >>>
# (in test file test/fixtures/bats/failing.bats, line 4)
#   `eval "( exit ${STATUS:-1} )"' failed
[20035] not ok 'a failing test'

@lzap
Copy link

lzap commented Sep 15, 2015

Hmm looks good, if there is chance of having an extra option(s) to configure bats to output to STDOUT, could be helpful too.

@kakawait
Copy link

really helpful feature! Can't imagine develop bash testing without (STDOUT)

@harschware
Copy link

Our team uses BATS, and has been struggling with STDOUT being gobbled by BATS. It seems to me the most useful solution is to have BATS have an option to write TAP output to a file, instead of STDOUT, and just let STDOUT alone so anything written to STDOUT by any process or sub-process proceeds as normal.

@csakoda
Copy link

csakoda commented Mar 31, 2016

Any chance this will be merged?

kakawait added a commit to kakawait/bats-core that referenced this pull request Oct 31, 2017
kakawait added a commit to kakawait/bats-core that referenced this pull request Aug 22, 2018
kakawait added a commit to kakawait/bats-core that referenced this pull request Aug 22, 2018
kakawait added a commit to kakawait/bats-core that referenced this pull request Aug 22, 2018
kakawait added a commit to kakawait/bats-core that referenced this pull request Aug 22, 2018
kakawait added a commit to kakawait/bats-core that referenced this pull request Aug 22, 2018
yarikoptic pushed a commit to neurodebian/bats that referenced this pull request Aug 6, 2019
Makes appveyor version semver compliant
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants