From 812ab02bfa04f70aae1950304699a231860f72bd Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 16 Jan 2024 15:55:22 +0000 Subject: [PATCH] Add a run file with a consistent `test` task --- .tmux | 2 +- run | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 run diff --git a/.tmux b/.tmux index 9e021e4..6131250 100755 --- a/.tmux +++ b/.tmux @@ -20,7 +20,7 @@ tmux send-keys -t "${session_name}:vim" "nvim" Enter tmux split-pane -t "${session_name}:vim" -h -c "${session_path}" -p 40 tmux send-keys -t "${session_name}:vim.right" "php -S 0.0.0.0:9000 -t web" Enter tmux split-pane -t "${session_name}:vim" -c "${session_path}" -v -tmux send-keys -t "${session_name}:vim.bottom-right" "paratest && watch-changes web/modules/custom paratest" Enter +tmux send-keys -t "${session_name}:vim.bottom-right" "./run test && watch-changes web/modules/custom ./run test" Enter # 2. General shell use. tmux new-window -t "${session_name}" -c "${session_path}" diff --git a/run b/run new file mode 100755 index 0000000..652a577 --- /dev/null +++ b/run @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset + +PATH=${PATH}:./vendor/bin + +# Display a list of all available commands. +function help { + printf "%s [args]\n\nTasks:\n" "${0}" + + compgen -A function | grep -v "^_" | cat -n + + printf "\nExtended help:\n Each task has comments for general usage\n" +} + +# Run PHPUnit tests. +function test { + paratest --group lessons "${@}" +} + +TIMEFORMAT=$'\nTask completed in %3lR' +time "${@:-help}"