sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 518 forks source link

Add support for `.bats.sh` convention tests #200

Closed ArturGajowy closed 6 years ago

ArturGajowy commented 7 years ago

IntelliJ IDEA highlights each end of a Bats test case with an error marker when using .sh syntax highlighting, which makes Bats adoption much harder in some teams. Thus the feature proposal for supporting .bats.sh test files with a convention-based test discovery. From README.md:


Bash-compatible convention syntax

If your tools don't have built-in support for .bats syntax, you can still use Bats with its support for .bats.sh convention tests. Each function declaration starting with the funciton keyword is going to be converted to a Bats test. For example, running the following test file:

#!/usr/bin/env bats

function test_using_bash_convention_syntax {
  result="$(echo 2+2 | bc)"
  [ "$result" -eq 4 ]
}

will output:

$ bats bash_addition.bats.sh
 ✓ test_using_bash_convention_syntax

1 tests, 0 failures

Test suites

You can invoke the bats interpreter with multiple test file arguments, or with a path to a directory containing multiple .bats and / or .bats.sh files. Bats will run each test file individually and aggregate the results. If any test case fails, bats exits with a 1 status code.

ArturGajowy commented 7 years ago

@sstephenson any thoughts on that? Should we merge or should we close?

ArturGajowy commented 6 years ago

@sstephenson kindly ping :) What's your opinion on this proposal?

xmik commented 6 years ago

Hi @ArturGajowy, this git repository is no longer maintained. It is was mirror-forked to: https://github.com/bats-core/bats-core. So if you want your PR merged, you should repoint it to bats-core. Context:

ArturGajowy commented 6 years ago

Hi!

sorry, didn't notice :) Can you add a heads-up to the README.md?

On Tue, Nov 21, 2017 at 9:56 AM Ewa Czechowska notifications@github.com wrote:

Hi @ArturGajowy https://github.com/arturgajowy, this git repository is no longer maintained. It is was mirror-forked to: https://github.com/bats-core/bats-core. So if you want your PR merged, you should repoint it to bats-core. Context:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sstephenson/bats/pull/200#issuecomment-345958784, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcFbV20_vX1FI3A7C-wFgn2eWGLmmKXks5s4pA3gaJpZM4LbRk- .

xmik commented 6 years ago

I would also like that, but I think only @sstephenson can do that.