Skip to content

Commit

Permalink
#1607 Changed Makefiles to now use npm run instead of npx
Browse files Browse the repository at this point in the history
Signed-off-by: Ilyes Ben Dlala <ilyes.bendlala@iteratec.com>
  • Loading branch information
Ilyesbdlala committed Jul 4, 2023
1 parent ee6f701 commit b7e6ebb
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 17 deletions.
4 changes: 1 addition & 3 deletions auto-discovery/kubernetes/pull-secret-extractor/Makefile
Expand Up @@ -13,8 +13,6 @@ IMG ?= auto-discovery-secret-extractor
# Tag used for the image
IMG_TAG ?= sha-$$(git rev-parse --short HEAD)

JEST_VERSION ?= 27.0.6


##@ General

Expand Down Expand Up @@ -52,7 +50,7 @@ integration-test: docker-build docker-export kind-import
./integration-test/test-pod.sh ${IMG_NS}/${IMG}:${IMG_TAG}
kubectl wait --for=condition=ready --timeout=60s -n integration-test pod/init-container-test

cd integration-test && npm ci && npx --yes --package jest@$(JEST_VERSION) jest --ci --colors --coverage --passWithNoTests
cd integration-test && npm ci && npm run test:integration

##@ Build

Expand Down
2 changes: 1 addition & 1 deletion hooks.mk
Expand Up @@ -46,7 +46,7 @@ integration-tests: ## 🩺 Start integration test for this module in the namespa
@if [ -d "$(hook-prefix)/integration-tests" ]; then \
kubectl -n integration-tests delete scans --all; \
npm ci --prefix $(TESTS_HELPERS_DIR); \
cd $(hook-prefix)/integration-tests && npm ci && npm run test --package jest@$(JEST_VERSION); \
cd $(hook-prefix)/integration-tests && npm ci && npm run test:integration \
else \
echo ".: 🚫 Integration tests folder for $(name) does not exist, skipped."; \
fi
Expand Down
2 changes: 1 addition & 1 deletion scanners.mk
Expand Up @@ -89,4 +89,4 @@ deploy-with-scanner:
integration-tests:
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
kubectl -n integration-tests delete scans --all
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests
2 changes: 1 addition & 1 deletion scanners/ffuf/Makefile
Expand Up @@ -17,4 +17,4 @@ integration-tests:
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
kubectl -n integration-tests delete scans --all
kubectl apply -f ./integration-tests/configmap-wordlist.yaml -n integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests
2 changes: 1 addition & 1 deletion scanners/git-repo-scanner/Makefile
Expand Up @@ -22,4 +22,4 @@ integration-tests:
#kubectl -n integration-tests delete scans --all
#cd ../../tests/integration/ && npm ci
#cd ../../scanners/${scanner}
#npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests ${scanner}/integration-tests
#npm run test:integration -- ${scanner}/integration-tests
2 changes: 1 addition & 1 deletion scanners/semgrep/Makefile
Expand Up @@ -12,5 +12,5 @@ integration-tests:
cd $(PROJECT_DIR)/tests/integration/ && npm ci
cd $(SCANNERS_DIR)/${scanner}
kubectl -n integration-tests create configmap semgrep-test-file --from-file=integration-tests/testfile.py
npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests ${scanner}/integration-tests
npm run test:integration -- ${scanner}/integration-tests
kubectl -n integration-tests delete configmap semgrep-test-file
2 changes: 1 addition & 1 deletion scanners/test-scan/Makefile
Expand Up @@ -24,4 +24,4 @@ deploy-with-scanner:
integration-tests:
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
kubectl -n integration-tests delete scans --all
cd $(PROJECT_DIR)/tests/integration/ && npm ci && npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests generic/findings-validation.test.js
cd $(PROJECT_DIR)/tests/integration/ && npm ci && npm run test:integration -- generic/findings-validation.test.js
2 changes: 1 addition & 1 deletion scanners/zap-advanced/Makefile
Expand Up @@ -43,4 +43,4 @@ integration-tests:
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
kubectl -n integration-tests delete scans --all
kubectl apply -f ./integration-tests/scantype-configMap.yaml -n integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests
2 changes: 1 addition & 1 deletion scanners/zap/Makefile
Expand Up @@ -21,4 +21,4 @@ integration-tests:
--set="parser.image.repository=docker.io/$(IMG_NS)/$(parser-prefix)-zap" \
--set="parser.image.tag=$(IMG_TAG)"
kubectl apply -f ./integration-tests/automation-framework-configMap.yaml -n integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests
9 changes: 3 additions & 6 deletions test-base.mk
Expand Up @@ -36,8 +36,6 @@ endif
# IMG_TAG: Tag used to tag the newly created image. Defaults to the shortened commit hash
# prefixed with `sha-` e.g. `sha-ef8de4b7`
#
# JEST_VERSION: Defines the jest version used for executing the tests. Defaults to latest
#
# KIND_CLUSTER_NAME: Defines the name of the kind cluster (created by kind create cluster --name cluster-name)
#
# Examples:
Expand All @@ -53,7 +51,6 @@ IMG_NS ?= securecodebox
GIT_TAG ?= $$(git rev-parse --short HEAD)
BASE_IMG_TAG ?= sha-$(GIT_TAG)
IMG_TAG ?= "sha-$(GIT_TAG)"
JEST_VERSION ?= 29.3.1
KIND_CLUSTER_NAME ?= kind

parser-prefix = parser
Expand All @@ -74,9 +71,9 @@ install-deps-js:
cd ${module}/ && npm ci

.PHONY: unit-test-js
unit-test-js: install-deps-js
@echo ".: 🧪 Starting unit-tests for '$(name)' $(module) with 'jest@$(JEST_VERSION)'."
npx --yes --package jest@$(JEST_VERSION) jest --ci --colors --coverage --passWithNoTests ${name}/${module}/ --testPathIgnorePatterns /integration-tests/
unit-test-js:
@echo ".: 🧪 Starting unit-tests for '$(name)' $(module)."
npm run test:unit -- ${name}/${module}/

.PHONY: install-deps-py
install-deps-py:
Expand Down

0 comments on commit b7e6ebb

Please sign in to comment.