mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-07 19:32:17 +00:00
node expands a `**` pattern only from version 21 on, and install-node resolves to node 18 on debian, so the suite reported "Could not find" and exited 1 without running a single test. find now collects the files and node receives them as arguments. An empty suite exits non-zero for the same reason php and ruby already do: reporting success for a suite that never ran hides its absence.
23 lines
535 B
Bash
Executable File
23 lines
535 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
#
|
|
# Runs the JavaScript unit suite through node:test, Node's built-in runner.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../.." && pwd)"
|
|
|
|
cd "${REPO_ROOT}"
|
|
|
|
suite="tests/unit/javascript"
|
|
|
|
mapfile -t tests < <(find "${suite}" -name '*.test.js' | sort)
|
|
|
|
if ((${#tests[@]} == 0)); then
|
|
printf 'ERROR test-unit-javascript: no JavaScript unit tests in %s\n' "${suite}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
exec node --test "${tests[@]}"
|