generated from devlinjunker/template.github.semver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from devlinjunker/release-0.2
release-0.2
- Loading branch information
Showing
43 changed files
with
926 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[submodule "lib/bats-core"] | ||
path = lib/bats-core | ||
url = https://github.com/bats-core/bats-core | ||
[submodule "lib/bats-assert"] | ||
path = lib/bats-assert | ||
url = https://github.com/bats-core/bats-assert | ||
[submodule "lib/bats-support"] | ||
path = lib/bats-support | ||
url = https://github.com/bats-core/bats-support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shellcheck*/ |
Submodule bats-assert
added at
0a8dd5
Submodule bats-support
added at
d140a6
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Testing | ||
|
||
The `qa/` directory contains files used during testing. It is named "qa" so that it will precede the `script/` and `src/` directories that it will be testing in Pull Requests. | ||
|
||
Each feature that is added to this project should include test files that detail the expectations for the new feature. If there is a new unit testing framework needed, please [submit an issue](https://github.com/devlinjunker/example.cii/issues/new/choose). | ||
|
||
For now this includes: | ||
- unit tests with BATS for script files | ||
|
||
## Test Running Script | ||
The `scripts/bin/` directory also contains a script file (`test.sh`) that manages running all of the test files. This will either: | ||
- run all tests if no arguments are passed (or `-a/--all`) | ||
- or will try to find a specific file to run with the `-f/--file` argument | ||
|
||
## Other Ideas | ||
- integration tests | ||
- e2e tests | ||
- automation tests | ||
- contract tests | ||
- mutation tests | ||
- helpers? | ||
- BATS helper - mocking/stubbing/spying (see [here](scripts/release/release-prep-upmerge.bats)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Testing Script Files | ||
|
||
Shell Script testing is done with [BATS]. These tests are organized in the same structure as the `script/` file directory and test files will have the same name as the script they are testing. | ||
|
||
|
||
To run every BATS test: | ||
``` | ||
lib/bats-core/bin/bats qa -r | ||
``` | ||
|
||
To run a single BATS test: | ||
``` | ||
lib/bats-core/bin/bats <path to .bats file> | ||
``` | ||
|
||
|
||
[BATS]: https://bats-core.readthedocs.io/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env ../../..libs/bats/bin/bats | ||
load '../../../lib/bats-support/load' | ||
load '../../../lib/bats-assert/load' | ||
|
||
SCRIPT_DIR="$BATS_TEST_DIRNAME"/../../../scripts/hooks | ||
|
||
TEST_PREFIX="branch-name.sh -"; | ||
|
||
|
||
@test "$TEST_PREFIX should not allow branches that don't match output of prefix-list.sh or defaults" { | ||
function git() { | ||
echo "abc/test-name"; | ||
} | ||
export -f git | ||
|
||
BATS_PREFIX_LIST="" | ||
export BATS_PREFIX_LIST | ||
|
||
run "$SCRIPT_DIR"/branch-name.sh | ||
unset BATS_PREFIX_LIST | ||
|
||
assert_failure | ||
} | ||
|
||
@test "$TEST_PREFIX should allow default branch prefixes (feat, fix)" { | ||
function git() { | ||
echo "fix/test-name"; | ||
} | ||
export -f git | ||
|
||
run "$SCRIPT_DIR"/branch-name.sh | ||
|
||
assert_success | ||
|
||
function git() { | ||
echo "feat/test-name"; | ||
} | ||
export -f git | ||
|
||
run "$SCRIPT_DIR"/branch-name.sh | ||
|
||
assert_success | ||
} | ||
|
||
@test "$TEST_PREFIX should allow branches that match output of prefix-list.sh" { | ||
function git() { | ||
echo "abc/test-name"; | ||
} | ||
export -f git | ||
|
||
BATS_PREFIX_LIST="abc" | ||
export BATS_PREFIX_LIST | ||
|
||
run "$SCRIPT_DIR"/branch-name.sh | ||
unset BATS_PREFIX_LIST | ||
|
||
assert_success | ||
} | ||
|
||
@test "$TEST_PREFIX should allow patch branches" { | ||
function git() { | ||
echo "patch-0.0.1" | ||
} | ||
export -f git | ||
|
||
run "$SCRIPT_DIR"/branch-name.sh | ||
assert_success | ||
} |
Oops, something went wrong.