Skip to content

Instantly share code, notes, and snippets.

@gabmontes
Created October 10, 2024 14:11
Show Gist options
  • Save gabmontes/eebae5a370d3195561091901ace27b55 to your computer and use it in GitHub Desktop.
Save gabmontes/eebae5a370d3195561091901ace27b55 to your computer and use it in GitHub Desktop.
Simple Bash script to test a package with all Node.js versions
#!/bin/bash
set -e
# shellcheck disable=SC1091
. "$NVM_DIR/nvm.sh"
test_node_version() {
VERSION=$1
echo "Testing Node $VERSION -------------------------------------------------"
nvm use "$VERSION"
rm -rf package-lock.json node_modules
npm i
npm test
}
VERSIONS=("22" "20" "18" "16" "14" "12" "10" "8" "6" "4" "0.12")
for VERSION in "${VERSIONS[@]}"; do
test_node_version "$VERSION"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment