-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
8 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Define Node versions | ||
NODE_VERSIONS=(16 17 18 19 20 21) | ||
|
||
# Function to install Jest-related dependencies globally | ||
install_jest_deps() { | ||
DEPS=$(jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | test("jest"; "i")) | .key + "@" + .value' package.json) | ||
for DEP in $DEPS | ||
do | ||
echo "Installing $DEP globally..." | ||
npm install -g "$DEP" | ||
done | ||
} | ||
|
||
# Loop through Node versions | ||
for VERSION in "${NODE_VERSIONS[@]}" | ||
npm install -g typescript yarn | ||
DEPS=$(jq -r '.dependencies, .devDependencies | to_entries[] | select(.key | test("jest"; "i")) | .key + "@" + .value' package.json) | ||
for DEP in $DEPS | ||
do | ||
echo "Setting up Node $VERSION" | ||
nvm install $VERSION | ||
nvm use $VERSION | ||
|
||
# Install Jest-related dependencies globally | ||
echo "Installing Jest-related dependencies for Node $VERSION" | ||
install_jest_deps | ||
|
||
# Test the project | ||
echo "Testing the project with Node $VERSION" | ||
npx jest | ||
|
||
# Add any additional commands, like running tests, if needed | ||
echo "Installing $DEP globally..." | ||
npm install -g "$DEP" | ||
done | ||
|
||
echo "Script completed." |