{"id":26943582,"url":"https://github.com/helly25/bashtest","last_synced_at":"2025-04-02T17:16:07.277Z","repository":{"id":284794833,"uuid":"956088549","full_name":"helly25/bashtest","owner":"helly25","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-27T17:28:43.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T18:30:49.929Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helly25.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2025-03-27T17:18:38.000Z","updated_at":"2025-03-27T17:28:47.000Z","dependencies_parsed_at":"2025-03-27T18:42:52.998Z","dependency_job_id":null,"html_url":"https://github.com/helly25/bashtest","commit_stats":null,"previous_names":["helly25/bashtest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helly25%2Fbashtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helly25%2Fbashtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helly25%2Fbashtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helly25%2Fbashtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helly25","download_url":"https://codeload.github.com/helly25/bashtest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246856688,"owners_count":20844974,"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":[],"created_at":"2025-04-02T17:16:06.597Z","updated_at":"2025-04-02T17:16:07.270Z","avatar_url":"https://github.com/helly25.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bashtest.sh - A Bazel shell test runner.\n\nThis shell test library provides Bazel macro rules to simplify shell testing.\n\nThe library is tested with continuous integration: [![Test](https://github.com/helly25/bashtest/actions/workflows/main.yml/badge.svg)](https://github.com/helly25/bashtest/actions/workflows/main.yml).\n\n## Bashtest\n\nRun one of the following commands to get detailed information on the actual bashtest.sh script:\n\n* `bazel run //bashtest:bashtest_help`\n* `bazel run //bashtest:bashtest_help | pandoc -s -t man | man -l -`\n* `bazel run //bashtest:bashtest_help | pandoc | lynx -stdin`\n\nThe flags can be used on the `bazel run` and `bazel test` commands (the latter requiring `--test_arg=...`).\n\n### Functionality\n\n* status helper `test_has_erro`: Returns whether a test function has had an error.\n* status helper `test_has_failed_tests`: Returns whether a test program had previous failing test functions.\n* expectation `expect_eq` \"\\${LHS}\" \"\\${RHS}\": Asserts that two strings are the same.\n* expectation `expect_ne` \"\\${LHS}\" \"\\${RHS}\": Asserts that two strings are different.\n* expectation `expect_files_eq` \"\\${LHS}\" \"\\${RHS}\": Asserts that two file are the same (supports golden updates).\n* expectation `expect_contains` \"\\${EXPECTED}\" \"\\${ARRAY[@]}\": Assert that one string is present in an array.\n* expectation `expect_not_contains` \"\\${EXPECTED}\" \"\\${ARRAY[@]}\": Assert that one string is not present in an array.\n* special test function `test::test_init`: If present, then this function runs first! Tests will only be executed if it succeeds.\n* special test function `test::test_done`: If present, then this function runs last!\n\n### Example\n\n1) Write a test that sources bashtest.\n\n```sh\nset -euo pipefail\n\n# shellcheck disable=SC1090,SC1091,SC2154\nsource \"${helly25_bashtest}\"\n\ntest::my_test() {\n  expect_ne \"Hello\" \"World\"\n  # Your tests go here...\n}\n\n# More tests go here...\n\ntest_runner\n```\n\n2) Write or extend a BUILD file\n\n```bzl\nload(\"@com_helly25_bashtest//bashtest:bashtest.bzl\", \"bashtest\")\n\nbashtest(\n    name = \"sh_test\",\n    srcs = [\"sh_test.sh\"],\n)\n```\n\n## Installation and requirements\n\nThis repository bash to work (Linux, MacOs).\n\n### WORKSPACE\n\nCheckout [Releases](https://github.com/helly25/bashtest/releases) or use head ref as follows:\n\n```\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\nhttp_archive(\n  name = \"com_helly25_bashtest\",\n  url = \"https://github.com/helly25/bashtest/archive/refs/heads/main.tar.gz\",\n  # See https://github.com/helly25/bashtest/releases for releases.\n)\n```\n\n### MODULES.bazel\n\nCheck [Releases](https://github.com/helly25/bashtest/releases) for details. All that is needed is a `bazel_dep` instruction with the correct version.\n\n```\nbazel_dep(name = \"helly25_bashtest\", version = \"0.0.0\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelly25%2Fbashtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelly25%2Fbashtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelly25%2Fbashtest/lists"}