File tree Expand file tree Collapse file tree 15 files changed +121
-65
lines changed
Expand file tree Collapse file tree 15 files changed +121
-65
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ bats_require_minimum_version 1.13.0
99load " ${BATS_TEST_DIRNAME} /libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
12+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1213
1314setup () {
14- export SCRIPT_DIR=" ${BATS_TEST_DIRNAME} /../scripts"
15+ export DEVTOOLS_ROOT=" ${BATS_TEST_DIRNAME} /.."
16+ export SCRIPT_DIR=" ${DEVTOOLS_ROOT} /scripts"
1517}
1618
1719@test " check-tools.sh checks for specified tools" {
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub actionlint 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " github-actions.sh runs actionlint when workflows exist" {
Original file line number Diff line number Diff line change @@ -13,16 +13,15 @@ load "${BATS_TEST_DIRNAME}/libs/bats-mock/stub.bash"
1313load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1414
1515setup () {
16- TEST_DIR=" $( temp_make) "
17- export TEST_DIR
18- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1918 cd " $TEST_DIR "
20- git init -q
19+ init_git_repo
2120}
2221
2322teardown () {
2423 unstub conform 2> /dev/null || true
25- safe_temp_del " $TEST_DIR "
24+ common_teardown
2625}
2726
2827@test " commits.sh skips on default branch" {
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export JAVA_LINTERS=" ${BATS_TEST_DIRNAME} /../linters/java"
16+ common_setup
17+ export JAVA_LINTERS=" ${DEVTOOLS_ROOT} /linters/java"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub mvn 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " lint.sh skips when no pom.xml present" {
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub reuse 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " license.sh runs reuse lint" {
Original file line number Diff line number Diff line change @@ -10,24 +10,23 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
22- unstub rumdl 2> /dev/null || true
23- temp_del " $TEST_DIR "
22+ common_teardown
2423}
2524
2625@test " markdown.sh check runs rumdl" {
2726 cat > test.md << 'EOF '
2827# Test
2928EOF
30- stub rumdl " check . --disable MD013 : true"
29+ stub_repeated rumdl " true"
3130
3231 run --separate-stderr " $LINTERS_DIR /markdown.sh" check
3332
4039 cat > test.md << 'EOF '
4140# Test
4241EOF
43- stub rumdl " check --fix . --disable MD013 : true"
42+ stub_repeated rumdl " true"
4443
4544 run --separate-stderr " $LINTERS_DIR /markdown.sh" fix
4645
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export NODE_LINTERS=" ${BATS_TEST_DIRNAME} /../linters/node"
16+ common_setup
17+ export NODE_LINTERS=" ${DEVTOOLS_ROOT} /linters/node"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub npx 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " eslint.sh skips when no package.json present" {
Original file line number Diff line number Diff line change @@ -13,16 +13,15 @@ load "${BATS_TEST_DIRNAME}/libs/bats-mock/stub.bash"
1313load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1414
1515setup () {
16- TEST_DIR=" $( temp_make) "
17- export TEST_DIR
18- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1918 cd " $TEST_DIR "
20- git init -q
19+ init_git_repo
2120}
2221
2322teardown () {
2423 unstub gitleaks 2> /dev/null || true
25- safe_temp_del " $TEST_DIR "
24+ common_teardown
2625}
2726
2827@test " secrets.sh runs gitleaks" {
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub shfmt 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " shell-fmt.sh check runs shfmt" {
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ load "${BATS_TEST_DIRNAME}/libs/bats-support/load.bash"
1010load " ${BATS_TEST_DIRNAME} /libs/bats-assert/load.bash"
1111load " ${BATS_TEST_DIRNAME} /libs/bats-file/load.bash"
1212load " ${BATS_TEST_DIRNAME} /libs/bats-mock/stub.bash"
13+ load " ${BATS_TEST_DIRNAME} /test_helper.bash"
1314
1415setup () {
15- TEST_DIR=" $( temp_make) "
16- export TEST_DIR
17- export LINTERS_DIR=" ${BATS_TEST_DIRNAME} /../linters"
16+ common_setup
17+ export LINTERS_DIR=" ${DEVTOOLS_ROOT} /linters"
1818 cd " $TEST_DIR "
1919}
2020
2121teardown () {
2222 unstub shellcheck 2> /dev/null || true
23- temp_del " $TEST_DIR "
23+ common_teardown
2424}
2525
2626@test " shell.sh runs shellcheck on shell files" {
You can’t perform that action at this time.
0 commit comments