Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reports are blank when using --report-formatter flag and docker #690

@luishernandezv

Description

@luishernandezv

Describe the bug
Report.xml has no contents when using docker to run tests.

To Reproduce

Suppose you have a folder structure like the following:

.
├─ test 
      ├─ test.bats

And you are running tests like this:

Replace YOUR_DOCKER_IMAGE

docker run -it -v `pwd`:`pwd` -w `pwd` YOUR_DOCKER_IMAGE sh -c 'bats -r test --report-formatter junit --output `pwd`'

This renders an empty report file.

Expected behavior
Report file contains results of tests

Environment:

  • Bats Version 1.8.2
  • OS: MacOS Ventura 13.1

Additional context

If you add a sleep to the end of the command

docker run -it -v `pwd`:`pwd` -w `pwd` YOUR_DOCKER_IMAGE sh -c 'bats -r test --report-formatter junit --output `pwd`; sleep 5'

This renders a proper report file.

Not sure of the internals of bats but it seems that the process to write the reports is separate from the main process which allows docker to exit without waiting for the report to be written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: HighBroken behavior in specific environments like in parallel mode or only on some operating systemsSize: MediumChanges in the same fileType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions