Split test suites for explicit runtime execution. - Move model-related tests under `src/models/*`. - Move CLI/integration tests under `src/integration/*`. - Add `src/store.helpers.unit.test.ts` for helper unit coverage. - Add shared Vitest config with default timeout and suite organization. - Remove legacy flat test files from `src/` root. - Keep core test commands in scripts supporting unit/models/integration runs.
47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# qmd - Quick Markdown Search
|
|
set -euo pipefail
|
|
|
|
# Find node - prefer PATH, fallback to known locations
|
|
find_node() {
|
|
if command -v node &>/dev/null; then
|
|
local ver=$(node --version 2>/dev/null | sed 's/^v//' || echo "0")
|
|
local major="${ver%%.*}"
|
|
if [[ "$major" -ge 22 ]]; then
|
|
command -v node
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
# Fallback: derive paths (need HOME)
|
|
: "${HOME:=$(eval echo ~)}"
|
|
|
|
# Check known locations
|
|
local candidates=(
|
|
"$HOME/.local/share/mise/installs/node/latest/bin/node"
|
|
"$HOME/.local/share/mise/shims/node"
|
|
"$HOME/.asdf/shims/node"
|
|
"/opt/homebrew/bin/node"
|
|
"/usr/local/bin/node"
|
|
"$HOME/.nvm/current/bin/node"
|
|
)
|
|
for c in "${candidates[@]}"; do
|
|
[[ -x "$c" ]] && { echo "$c"; return 0; }
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
NODE=$(find_node) || { echo "Error: node (>=22) not found. Install from https://nodejs.org" >&2; exit 1; }
|
|
|
|
# Resolve symlinks to find script location
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
while [[ -L "$SOURCE" ]]; do
|
|
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
SOURCE="$(readlink "$SOURCE")"
|
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
done
|
|
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
|
|
exec "$NODE" --import tsx "$SCRIPT_DIR/src/qmd.ts" "$@"
|