From d6cc4f8d1c849eec656d2f3d8573d9c23973954b Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 24 Oct 2026 20:39:17 +0200 Subject: [PATCH 1/6] docs: fix quickstart commands for npm installs --- CHANGELOG.md | 2 ++ docs/quickstart.md | 36 +++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5bcfd50..a66a616d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Fixed +- Quickstart commands match the install.sh, npm project, and npm global installation paths + - Parallel runs count tests under relative hidden paths and keep their results separate from matching visible paths (#1393) ### Changed diff --git a/docs/quickstart.md b/docs/quickstart.md index df5553e8..b788d633 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -16,14 +16,12 @@ Pick whichever fits your project. See [installation](/installation) for the comp curl -s https://bashunit.com/install.sh | bash ``` -```bash [npm] -# Per-project (pinned in package.json), run via npx +```bash [npm project] npm install --save-dev bashunit -npx bashunit tests/ +``` -# Global install, run directly on PATH +```bash [npm global] npm install -g bashunit -bashunit tests/ ``` ::: @@ -34,10 +32,20 @@ The `install.sh` route creates `lib/bashunit`; the npm route exposes `bashunit` Create a test suite with the `init` subcommand: -```bash +::: code-group +```bash [install.sh] ./lib/bashunit init tests ``` +```bash [npm project] +npx bashunit init tests +``` + +```bash [npm global] +bashunit init tests +``` +::: + It creates, in the current directory: - `tests/bootstrap.sh`: sourced before your tests; put shared setup here @@ -66,9 +74,19 @@ Alternatively, create your tests manually: ::: 3. Run the test: - ```bash - ./lib/bashunit tests + ::: code-group + ```bash [install.sh] + ./lib/bashunit tests/ + ``` + + ```bash [npm project] + npx bashunit tests/ + ``` + + ```bash [npm global] + bashunit tests/ ``` + ::: 4. The output should look like this: ```-vue @@ -88,7 +106,7 @@ Alternatively, create your tests manually: ## Running your suite -With no path, bashunit runs `tests/` (`BASHUNIT_DEFAULT_PATH`): +With no path, bashunit runs `tests/` (`BASHUNIT_DEFAULT_PATH`). The examples below use the `install.sh` path; for an npm project, replace `./lib/bashunit` with `npx bashunit`, or with `bashunit` for a global install: ```bash ./lib/bashunit # run tests/ From 4c8ab55c788b5df7ee6272bc9abe88966af27619 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 24 Oct 2026 20:39:21 +0200 Subject: [PATCH 2/6] docs: add a working test to the homepage --- CHANGELOG.md | 2 ++ docs/index.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a66a616d..f9d65858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Added +- The homepage shows a Bash function, its test, the run command, and passing output + - Blog posts for releases 0.43.0 through 0.52.0, including the 0.50.1 cleanup patch ### Fixed diff --git a/docs/index.md b/docs/index.md index 4642c062..213a69ea 100644 --- a/docs/index.md +++ b/docs/index.md @@ -40,6 +40,67 @@ features: details: Run the same tests on Linux, macOS and Windows via WSL. --- +
+ +## Test your first Bash function + +Install bashunit and create folders for your script and test: + +```bash +curl -s https://bashunit.com/install.sh | bash +mkdir -p src tests +``` + +Save these two files: + +::: code-group +```bash [src/greet.sh] +#!/usr/bin/env bash + +function greet() { + printf 'Hello, %s!\n' "${1:-world}" +} +``` + +```bash [tests/greet_test.sh] +#!/usr/bin/env bash + +function set_up() { + source src/greet.sh +} + +function test_greet_by_name() { + assert_same "Hello, Bash!" "$(greet Bash)" +} +``` +::: + +Run your test: + +```bash +./lib/bashunit tests/ +``` + +A passing run reports: + +```text +✓ Passed: Greet by name + +Tests: 1 passed, 1 total +Assertions: 1 passed, 1 total +``` + +Continue with the [Quickstart](/quickstart) for other install methods and running options. + +
+ + + From 8db75f17457a524d7de097042107b9b0e5368285 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Sat, 24 Oct 2026 21:00:49 +0200 Subject: [PATCH 6/6] docs: tighten unreleased changelog entries --- CHANGELOG.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e732735..c7814e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,26 +4,21 @@ ### Added -- The homepage shows a Bash function, its test, the run command, and passing output - +- Homepage example with a Bash function, test, run command and passing output - Blog posts for releases 0.43.0 through 0.52.0, including the 0.50.1 cleanup patch ### Fixed -- The homepage logo honors reduced motion, updates when the preference changes, and cleans up on navigation - -- Primary documentation buttons use readable dark text in both themes, including hover and active states - -- Quickstart commands match the install.sh, npm project, and npm global installation paths - +- Homepage logo follows reduced-motion preferences and stops tracking the pointer after navigation +- Primary buttons use dark text in both themes, including hover and active states +- Quickstart commands match install.sh, npm project and npm global installs - Parallel runs count tests under relative hidden paths and keep their results separate from matching visible paths (#1393) ### Changed -- Common testing patterns appear under Writing Tests, with function and script recipes linked from the Quickstart - -- Documentation uses shorter, clearer wording across guides, reference pages and release posts -- Large provider and annotation maps use an index instead of scanning earlier entries, speeding up test files on Bash 3.0 and newer (#1392) +- Common patterns appears under Writing Tests; Quickstart links to function and script testing recipes +- Shortened guides, reference pages and release posts +- Large provider and annotation maps use indexed lookups to speed up test files on Bash 3.0 and newer (#1392) ## [0.52.0](https://github.com/TypedDevs/bashunit/compare/0.51.0...0.52.0) - 2026-10-11