File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,14 @@ Which shell check image to use.
5555
5656Default : ` koalaman/shellcheck`
5757
58+ # # Developing
59+
60+ To run the tests :
61+
62+ ` ` ` bash
63+ docker-compose run --rm tests bats tests
64+ ` ` `
65+
5866# # License
5967
6068MIT (see [LICENSE](LICENSE))
Original file line number Diff line number Diff line change 1+ services :
2+ tests :
3+ image : buildkite/plugin-tester:v4.1.1
4+ volumes :
5+ - " .:/plugin"
Original file line number Diff line number Diff line change @@ -189,3 +189,39 @@ load "${BATS_PLUGIN_PATH}/load.bash"
189189
190190 unstub docker
191191}
192+
193+ @test " Shellcheck uses default image when not specified" {
194+ export BUILDKITE_PLUGIN_SHELLCHECK_FILES_0=" tests/testdata/test.sh"
195+ unset BUILDKITE_PLUGIN_SHELLCHECK_IMAGE
196+ unset BUILDKITE_PLUGIN_SHELLCHECK_VERSION
197+
198+ stub docker \
199+ " run --rm -v $PWD :/mnt --workdir /mnt koalaman/shellcheck:stable --color=always tests/testdata/test.sh : echo running shellcheck on test.sh"
200+
201+ run " $PWD /hooks/command"
202+
203+ assert_success
204+ assert_output --partial " Running shellcheck on 1 files"
205+ assert_output --partial " running shellcheck on test.sh"
206+ assert_output --partial " Files are ok"
207+
208+ unstub docker
209+ }
210+
211+ @test " Shellcheck uses default image when specified" {
212+ export BUILDKITE_PLUGIN_SHELLCHECK_FILES_0=" tests/testdata/test.sh"
213+ export BUILDKITE_PLUGIN_SHELLCHECK_IMAGE=" foo/shellcheck"
214+ export BUILDKITE_PLUGIN_SHELLCHECK_VERSION=" bar"
215+
216+ stub docker \
217+ " run --rm -v $PWD :/mnt --workdir /mnt foo/shellcheck:bar --color=always tests/testdata/test.sh : echo running shellcheck on test.sh"
218+
219+ run " $PWD /hooks/command"
220+
221+ assert_success
222+ assert_output --partial " Running shellcheck on 1 files"
223+ assert_output --partial " running shellcheck on test.sh"
224+ assert_output --partial " Files are ok"
225+
226+ unstub docker
227+ }
You can’t perform that action at this time.
0 commit comments