Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@ npx lint-staged
echo "🧪 Running tests..."
npm test

# # Run Spectral linting on Postman collections if they changed
# if git diff --cached --name-only | grep -qE "postman/collections/"; then
# echo "📋 Linting Postman collections with Spectral..."
# node .spectral/lint-with-names.js
# Run Spectral linting on Postman collections if they changed
if git diff --cached --name-only | grep -qE "postman/collections/"; then
echo "📋 Linting Postman collections with Spectral..."
node .spectral/lint-with-names.js

# if [ $? -ne 0 ]; then
# echo "❌ Spectral linting failed for Postman collections"
# exit 1
# fi
if [ $? -ne 0 ]; then
echo "❌ Spectral linting failed for Postman collections"
exit 1
fi

# echo "✅ Postman collection linting passed!"
# fi
echo "✅ Postman collection linting passed!"
fi

# # Run Postman tests only if Postman collection files changed
# if git diff --cached --name-only | grep -qE "postman/"; then
# echo "📬 Postman collection changed - Running Postman tests..."
# Run Postman tests only if Postman collection files changed
if git diff --cached --name-only | grep -qE "postman/"; then
echo "📬 Postman collection changed - Running Postman tests..."

# # Run all collections in postman/collections/
# for collection in postman/collections/*.postman_collection.json; do
# if [ -f "$collection" ]; then
# echo " → Running: $(basename "$collection")"
# postman collection run "$collection"
# Run all collections in postman/collections/
for collection in postman/collections/*.postman_collection.json; do
if [ -f "$collection" ]; then
echo " → Running: $(basename "$collection")"
postman collection run "$collection"

# if [ $? -ne 0 ]; then
# echo "❌ Postman collection failed: $collection"
# exit 1
# fi
# fi
# done
if [ $? -ne 0 ]; then
echo "❌ Postman collection failed: $collection"
exit 1
fi
fi
done

# echo "✅ All Postman collections passed!"
# else
# echo "⏭️ No Postman collection changes detected, skipping Postman tests"
# fi
echo "✅ All Postman collections passed!"
else
echo "⏭️ No Postman collection changes detected, skipping Postman tests"
fi

echo "✅ All pre-commit checks passed!"
12 changes: 12 additions & 0 deletions .postman/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"workspace": {
"id": "c9864502-aa44-4ebf-bebd-cc1186e4c94b"
},
"entities": {
"collections": ["../postman/collections/Banking-API-Demo.postman_collection.json"],
"environments": [],
"specs": [],
"flows": [],
"globals": []
}
}
Loading
Loading