Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): update information about dev-container-features-test-lib's functions #899

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions docs/features/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,25 @@ reportResults

The `dev-container-features-test-lib` is convenience helper [defined in the CLI](https://github.com/devcontainers/cli/blob/1910ca41015c627b884ddd69ebc52d1e8cdd8cf0/src/spec-node/featuresCLI/utils.ts#L59) that adds several bash functions to organize test asserts. Note that using this libary **is not required**.

#### `check <LABEL> <cmd> [args...]`
Description: Executes `cmd` and prints success/failed depending on exit code (0 === success) of `cmd`.
Note: Use quotes to include whitespace in the label or individual arguments for the command.
### `check LABEL EXPRESSION`

Executes `EXPRESSION` (command) and prints success/failed depending on the exit code (0 === success) of the command.

Note:
- Use quotes to include whitespace in the label or individual arguments for the command.

Example: `check "python is available" python3 --version`

##### reportResults
Prints results of check and checkMultiple
### `checkMultiple LABEL MINIMUM_NUMBER_OF_PASSED_EXPRESSIONS EXPRESSIONS...`

Executes multiple `EXPRESSIONS` (commands) and prints success/failed depending on the number of successful executions. If the number of successful executions is equal to or higher than `MINIMUM_NUMBER_OF_PASSED_EXPRESSIONS`, the check is considered a success.

Note:
- `MINIMUM_NUMBER_OF_PASSED_EXPRESSIONS` should not be higher than the total number of `EXPRESSIONS`.
- Commands passed as expressions must be enclosed in quotes.

Example: `checkMultiple "python and node are available" 2 "python3 --version" "node --version"`

### `reportResults`

Prints results of `check` and `checkMultiple`