19 lines
747 B
Bash
Executable File
19 lines
747 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Reuse Vaadin's Node installation after the production frontend build.
|
|
set -euo pipefail
|
|
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
|
cd "$root"
|
|
if [[ -x ${HOME}/.vaadin/node/bin/node ]]; then
|
|
frontend_node="${HOME}/.vaadin/node/bin/node"
|
|
else
|
|
# Current Vaadin versions install Node in a versioned directory.
|
|
frontend_node=""
|
|
while IFS= read -r candidate; do
|
|
if [[ -x $candidate ]]; then frontend_node=$candidate; break; fi
|
|
done < <(printf '%s\n' "${HOME}"/.vaadin/node-v*/bin/node | sort -Vr)
|
|
if [[ -z $frontend_node ]]; then
|
|
frontend_node=$(command -v node) || { echo 'No Node runtime available for frontend tests.' >&2; exit 1; }
|
|
fi
|
|
fi
|
|
"$frontend_node" --test tests/frontend/*.test.cjs
|