Skip to content

Commit

Permalink
Merge branch 'main' into fix-test-doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-gg-dev committed Mar 3, 2024
2 parents 378b48d + 1b1ff46 commit 613c242
Show file tree
Hide file tree
Showing 59 changed files with 1,895 additions and 3,162 deletions.
15 changes: 3 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,25 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

[**.sh]
indent_style = space
indent_size = 2

[**.sh]
max_line_length = 120

[**.md]
indent_style = space
indent_size = 4

[**.ts]
indent_style = space
indent_size = 2
max_line_length = 120

[**.css]
indent_style = space
indent_size = 2
max_line_length = 120

[**.json]
indent_style = space
indent_size = 2

[docs/**.md] # YAML support
indent_size = 2

[{Makefile,**.mk}]
[{Makefile,**.mk,.git*}]
indent_style = tab

[{tests/acceptance/**.sh,src/console_header.sh}]
Expand Down
9 changes: 4 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ Please make sure you have [set up your username and email address](https://git-s
## Specific set up for documentation application

Our documentation is build with [VitePress](https://vitepress.dev/), for set up a local environment to contribute follow these steps:
1. You'll need `node` (_we recommend using [nvm](https://github.com/nvm-sh/nvm)_) and `yarn` for set up the environment.
1. You'll need `node` (_we recommend using [nvm](https://github.com/nvm-sh/nvm)_) and `npm` for set up the environment.
* Using `nvm` you can execute `nvm use`(reads _.nvmrc_ file) in the project root directory and follow the instructions to use the correct `node` version.
* To use `yarn` you need to execute `corepack enable` to activate [Corepack](https://nodejs.org/api/corepack.html).
2. Install dependencies with `yarn install`.
3. Run local development server with `yarn docs:dev`.
2. Install dependencies with `npm ci`.
3. Run local development server with `npm run docs:dev`.
4. Implement your changes.
5. Before submitting your Pull Request run `docs:build` to ensure everything works.
5. Before submitting your Pull Request run `npm run docs:build` to ensure everything works.

## Change the configuration
To change the configuration for the project we use the `.env` file if you would like to know what variables should be there use the following command:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn install --immutable
run: npm ci
- name: Build with VitePress
run: |
yarn docs:build
npm run docs:build
touch docs/.vitepress/dist/.nojekyll
6 changes: 3 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn install --immutable
run: npm ci
- name: Build with VitePress
run: |
yarn docs:build
npm run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
Expand Down
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@

# docs
node_modules
yarn-error.log
docs/.vitepress/cache
docs/.vitepress/dist
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# installation
bin/bashunit
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.1.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc.yml

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

## [Unreleased](https://github.com/TypedDevs/bashunit/compare/0.10.1...main)
## [Unreleased](https://github.com/TypedDevs/bashunit/compare/0.11.0...main)

## [0.11.0](https://github.com/TypedDevs/bashunit/compare/0.10.1...0.11.0) - 2024-03-02

- Add `--upgrade` option to `./bashunit`
- Remove support to deprecated `setUp`, `tearDown`, `setUpBeforeScript` and `tearDownAfterScript` functions
- Optimize test execution time
- Test functions are now run in the order they're defined in a test file
- Increase contrast of test results

## [0.10.1](https://github.com/TypedDevs/bashunit/compare/0.10.0...0.10.1) - 2023-11-13

Expand Down
5 changes: 1 addition & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
MIT License

Copyright (c) 2023 Jose Maria Valera Reales <chema@typeddevs.com>
Emmanuel Valverde Ramos <manu@typeddevs.com>
Antonio Gonzalez Gea <antonio@typeddevs.com>
Fabrizio Fasanando Sotelo <fabrizio@typeddevs.com>
Copyright (c) 2023 TypedDevs <team@typeddevs.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 13 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SHELL=/bin/bash

STATIC_ANALYSIS_CHECKER := $(shell which shellcheck 2> /dev/null)
LINTER_CHECKER := $(shell which ec 2> /dev/null)
GIT_DIR = $(shell git rev-parse --git-dir 2> /dev/null)

OS:=
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -36,16 +37,15 @@ endif

help:
@echo ""
@echo "usage: make COMMAND"
@echo "Usage: make [command]"
@echo ""
@echo "Commands:"
@echo " test Run the test"
@echo " test/list List all the test under the tests directory"
@echo " test/watch Automatically run the test every second"
@echo " test/example Run test from the example directory"
@echo " env/example Makes a copy of the keys on your .env file"
@echo " pre_commit/install Installs the pre-commit hook"
@echo " pre_commit/run Function that will be called when the pre-commit runs"
@echo " test Run the tests"
@echo " test/list List all tests under the tests directory"
@echo " test/watch Automatically run tests every second"
@echo " env/example Copy variables without the values from .env into .env.example"
@echo " pre_commit/install Install the pre-commit hook"
@echo " pre_commit/run Function that will be called when the pre-commit hook runs"
@echo " sa Run shellcheck static analysis tool"
@echo " lint Run editorconfig linter tool"

Expand All @@ -68,32 +68,25 @@ test/watch: $(TEST_SCRIPTS)
@fswatch -m poll_monitor -or $(SRC_SCRIPTS_DIR) $(TEST_SCRIPTS_DIR) .env Makefile | xargs -n1 ./bashunit $(TEST_SCRIPTS)

env/example:
@echo "Copy the .env into the .env.example file without the values"
@echo "Copying variables without the values from .env into .env.example"
@sed 's/=.*/=/' .env > .env.example

pre_commit/install:
@echo "Installing pre-commit hooks"
cp $(PRE_COMMIT_SCRIPTS_FILE) ./.git/hooks/
@echo "Installing pre-commit hook"
cp $(PRE_COMMIT_SCRIPTS_FILE) $(GIT_DIR)/hooks/

pre_commit/run: test sa lint env/example

sa:
ifndef STATIC_ANALYSIS_CHECKER
@printf "\e[1m\e[31m%s\e[0m\n" "Shellcheck not installed: Static analisys not preformed!" && exit 1
@printf "\e[1m\e[31m%s\e[0m\n" "Shellcheck not installed: Static analysis not performed!" && exit 1
else
@shellcheck ./**/*.sh -C && printf "\e[1m\e[32m%s\e[0m\n" "ShellCheck: OK!"
endif

lint:
ifndef LINTER_CHECKER
@printf "\e[1m\e[31m%s\e[0m\n" "Editorconfig not installed: Lint not preformed!" && exit 1
@printf "\e[1m\e[31m%s\e[0m\n" "Editorconfig not installed: Lint not performed!" && exit 1
else
@ec -config .editorconfig && printf "\e[1m\e[32m%s\e[0m\n" "editorconfig-check: OK!"
endif

test/example:
@./bashunit $(EXAMPLE_TEST_SCRIPTS)

test/watch/example:
@./bashunit $(EXAMPLE_TEST_SCRIPTS)
@fswatch -m poll_monitor -or $(EXAMPLE_TEST_SCRIPTS) | xargs -n1 ./bashunit $(EXAMPLE_TEST_SCRIPTS)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<br>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/public/logo_name_dark.svg">
<img alt="bashunit" src="docs/public/logo_name.svg" width="400">
<source media="(prefers-color-scheme: dark)" srcset="docs/public/logo-name-dark.svg">
<img alt="bashunit" src="docs/public/logo-name.svg" width="400">
</picture>
</p>

Expand Down
2 changes: 1 addition & 1 deletion bashunit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# shellcheck disable=SC2034
declare -r BASHUNIT_VERSION="0.10.1"
declare -r BASHUNIT_VERSION="0.11.0"

readonly BASHUNIT_ROOT_DIR="$(dirname "${BASH_SOURCE[0]}")"
export BASHUNIT_ROOT_DIR
Expand Down
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

mkdir -p bin

cat src/*.sh > bin/temp.sh
echo '#!/usr/bin/env bash' > bin/temp.sh

cat src/*.sh >> bin/temp.sh
cat bashunit >> bin/temp.sh
grep -v '^source' bin/temp.sh > bin/bashunit
rm bin/temp.sh
Expand Down
27 changes: 22 additions & 5 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ export default defineConfig({
lastUpdated: true,

head: [
['link', { rel: 'icon', href: '/favicon.ico' }]
['link', { rel: 'icon', href: '/favicon.ico' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:image', content: '/og-image.png' }]
],
transformHead(context) {
const canonical = context.page.replace(/(index)?\.md$/, '')

return [
['meta', { property: 'og:title', content: context.title }],
['meta', { property: 'og:url', content: `https://bashunit.typeddevs.com/${canonical}` }],
['link', { rel: 'canonical', href: `https://bashunit.typeddevs.com/${canonical}` }],
]
},

sitemap: {
hostname: 'https://bashunit.typeddevs.com'
Expand All @@ -28,8 +39,8 @@ export default defineConfig({
},

logo: {
light: '/logo_navbar.svg',
dark: '/logo_navbar_dark.svg',
light: '/logo-navbar.svg',
dark: '/logo-navbar-dark.svg',
alt: 'bashunit'
},

Expand Down Expand Up @@ -103,8 +114,14 @@ export default defineConfig({
},

footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2023-present TypedDevs'
message: 'Released with ❤️ under the MIT License.',
copyright: `
Copyright © 2023-present
<a class="typeddevs-link" href="https://typeddevs.com/" target="_blank">
<img class="typeddevs-logo" src="/typeddevs.svg">
TypedDevs
</a>
`
}
},

Expand Down
10 changes: 10 additions & 0 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,13 @@ time {
.VPNavScreenMenu .VPNavScreenMenuLink {
font-weight: 600;
}

.typeddevs-link {
text-decoration: none !important;
}

.typeddevs-logo {
display: inline-block;
width: 1rem;
margin-left: 0.2rem;
}
48 changes: 48 additions & 0 deletions docs/ProductHuntBanner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<div class="product-hunt-banner__container">
<a
href="https://www.producthunt.com/posts/bashunit?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-bashunit"
target="_blank"
rel="noreferrer"
title="bashunit - Product Hunt"
>
<img
class="product-hunt-banner__logo--light"
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=417750&theme=light"
alt="Product Hunt"
/>
<img
class="product-hunt-banner__logo--dark"
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=417750&theme=dark"
alt="Product Hunt"
/>
</a>
</div>
</template>

<script>
export default {}
</script>

<style>
.product-hunt-banner__container {
text-align: center;
margin-top: 4rem;
}
.product-hunt-banner__logo--light{
display: inline-block;
}
.product-hunt-banner__logo--dark{
display: none;
}
.dark .product-hunt-banner__logo--light{
display: none;
}
.dark .product-hunt-banner__logo--dark{
display: inline-block;
}
</style>
2 changes: 1 addition & 1 deletion docs/blog/0000-00-00-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
date: 'YYYY-MM-DD'
title: 'Template title'
description: 'Template description'
coverUrl: '/social_preview.png'
coverUrl: '/social-preview.png'
coverAlt: 'Cover description'

aside: false
Expand Down
2 changes: 1 addition & 1 deletion docs/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Arguments:
Specifies the directory or file containing [...]
Options:
-f|--filer
-f|--filter
Filters the tests to run based on the test name.
[...]
Expand Down
3 changes: 3 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ A specification for adding human and machine-readable meaning to commit messages

### [Tito-Kati/fizzbuzz-bashunit](https://github.com/Tito-Kati/fizzbuzz-bashunit)
Popular introductory FizzBuzz kata solved in Bash with **bashunit** as the testing framework.

### [phpctl](https://github.com/opencodeco/phpctl)
It is a Docker (containers) based development environment for PHP.
Loading

0 comments on commit 613c242

Please sign in to comment.