{"id":21164755,"url":"https://github.com/chiefbiiko/bashert","last_synced_at":"2026-04-24T18:38:29.289Z","repository":{"id":129103473,"uuid":"318813269","full_name":"chiefbiiko/bashert","owner":"chiefbiiko","description":"bash assertions 4 pure bash test suites :DD","archived":false,"fork":false,"pushed_at":"2021-05-19T15:19:56.000Z","size":13,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T09:48:54.272Z","etag":null,"topics":["assertions","bash","github-actions-ci","testing"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiefbiiko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-05T14:49:13.000Z","updated_at":"2021-12-10T22:55:15.000Z","dependencies_parsed_at":"2023-07-26T16:30:41.117Z","dependency_job_id":null,"html_url":"https://github.com/chiefbiiko/bashert","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefbiiko%2Fbashert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefbiiko%2Fbashert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefbiiko%2Fbashert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiefbiiko%2Fbashert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiefbiiko","download_url":"https://codeload.github.com/chiefbiiko/bashert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243611109,"owners_count":20319090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertions","bash","github-actions-ci","testing"],"created_at":"2024-11-20T14:11:23.922Z","updated_at":"2025-12-28T18:57:50.582Z","avatar_url":"https://github.com/chiefbiiko.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bashert\n\n![ci](https://github.com/chiefbiiko/bashert/workflows/ci/badge.svg) [![bash](https://badges.frapsoft.com/bash/v1/bash.png?v=103)](./mod.sh)\n\na small set of bash `assert_*` functions 4u2 write test suites in pure bash :DD\n\n## helpers\n\nif any of the assertions do not hold true an error is printed to `stderr` and the helper calls `exit 1`\n\n```bash\nassert_status ./curl_header_dump 204\nassert_equal twin twin\nassert_not_equal fraud fr@ud\nassert_match acab '^acab|ACAB$'\nassert_files_equal ./a ./b\nassert_files_equal_ignore_space ./a ./b\nassert_gt 419 255\nassert_lt -1 0\n\nlurc() {\n  curl -sS --proto '=https' --tlsv1.2 \"$@\"\n}\n```\n\n2 save u headache when using `assert_match` make sure 2 use single quotes around the second pattern arg\n\nuse `lurc` instead of plain `curl` to require `TLS 1.2` for every connection and silent `curl` as long as there are no errors\n\n## usage\n\n`touch` two files `test_suite.sh` and `.github/workflows/ci.yml` as below\n### `test_suite.sh`\n\nsource `bashert.sh` from a local copy or via the network, then define test cases with simple `bash` function declarations making use of the provided assertion helpers, fx:\n\n```bash\nsource \u003c(curl -sSf https://raw.githubusercontent.com/chiefbiiko/bashert/v1.1.0/bashert.sh)\n\ntest_users_list_200() {\n  printf \"test_users_list_200\\n\"\n\n  resp_head=$(mktemp)\n  resp_body=$(mktemp)\n\n  lurc \\\n    -X GET \\\n    -D $resp_head \\\n    https://jsonplaceholder.typicode.com/users \\\n  \u003e $resp_body\n\n  assert_status $resp_head 200\n\n  count=$(jq length $resp_body)\n\n  assert_gt $count 0\n\n  id=$(jq -r '.[0].id' $resp_body)\n  username=\"$(jq -r '.[0].username' $resp_body)\"\n\n  assert_equal $id 1\n  assert_match \"$username\" '^[a-zA-Z0-9_-]+$'\n}\n```\n\n\u003e `source`ing from a url like above only works on `ubuntu` runners\n\n### `.github/workflows/ci.yml`\n\n1. source your custom `test_suite.sh`\n2. call your `bash` test case functions\n\n```bash\n    steps:\n      - uses: actions/checkout@v2.3.4\n      - run: |\n          source ./test_suite.sh\n          test_users_list_200\n```\n\n\u003e obviously, this needs 2 run in `bash` and you probly also want tools like `curl` and `jq` available in that shell - fortunately, when using github actions `ubuntu-*` and `macos-*` runners we get `curl` and `jq` preinstalled amongst other things\n\n## license\n\n[MIT](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefbiiko%2Fbashert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiefbiiko%2Fbashert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiefbiiko%2Fbashert/lists"}