Skip to content

Commit e0e7a1a

Browse files
IlyesbdlalaJ12934
authored andcommitted
#1607 Changed Makefiles to now use npm run instead of npx
Signed-off-by: Ilyes Ben Dlala <ilyes.bendlala@iteratec.com>
1 parent 816cd7b commit e0e7a1a

10 files changed

Lines changed: 12 additions & 17 deletions

File tree

auto-discovery/kubernetes/pull-secret-extractor/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ IMG ?= auto-discovery-secret-extractor
1313
# Tag used for the image
1414
IMG_TAG ?= sha-$$(git rev-parse --short HEAD)
1515

16-
JEST_VERSION ?= 27.0.6
17-
1816

1917
##@ General
2018

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

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

5755
##@ Build
5856

hooks.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ integration-tests: ## 🩺 Start integration test for this module in the namespa
4646
@if [ -d "$(hook-prefix)/integration-tests" ]; then \
4747
kubectl -n integration-tests delete scans --all; \
4848
npm ci --prefix $(TESTS_HELPERS_DIR); \
49-
cd $(hook-prefix)/integration-tests && npm ci && npm run test --package jest@$(JEST_VERSION); \
49+
cd $(hook-prefix)/integration-tests && npm ci && npm run test:integration \
5050
else \
5151
echo ".: 🚫 Integration tests folder for $(name) does not exist, skipped."; \
5252
fi

scanners.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ deploy-with-scanner:
8989
integration-tests:
9090
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
9191
kubectl -n integration-tests delete scans --all
92-
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
92+
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests

scanners/ffuf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ integration-tests:
1717
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
1818
kubectl -n integration-tests delete scans --all
1919
kubectl apply -f ./integration-tests/configmap-wordlist.yaml -n integration-tests
20-
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
20+
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests

scanners/git-repo-scanner/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ integration-tests:
2222
#kubectl -n integration-tests delete scans --all
2323
#cd ../../tests/integration/ && npm ci
2424
#cd ../../scanners/${scanner}
25-
#npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests ${scanner}/integration-tests
25+
#npm run test:integration -- ${scanner}/integration-tests

scanners/semgrep/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ integration-tests:
1212
cd $(PROJECT_DIR)/tests/integration/ && npm ci
1313
cd $(SCANNERS_DIR)/${scanner}
1414
kubectl -n integration-tests create configmap semgrep-test-file --from-file=integration-tests/testfile.py
15-
npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests ${scanner}/integration-tests
15+
npm run test:integration -- ${scanner}/integration-tests
1616
kubectl -n integration-tests delete configmap semgrep-test-file

scanners/test-scan/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ deploy-with-scanner:
2424
integration-tests:
2525
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
2626
kubectl -n integration-tests delete scans --all
27-
cd $(PROJECT_DIR)/tests/integration/ && npm ci && npx --yes --package jest@$(JEST_VERSION) jest --verbose --ci --colors --coverage --passWithNoTests generic/findings-validation.test.js
27+
cd $(PROJECT_DIR)/tests/integration/ && npm ci && npm run test:integration -- generic/findings-validation.test.js

scanners/zap-advanced/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ integration-tests:
4343
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
4444
kubectl -n integration-tests delete scans --all
4545
kubectl apply -f ./integration-tests/scantype-configMap.yaml -n integration-tests
46-
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
46+
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests

scanners/zap/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ integration-tests:
2121
--set="parser.image.repository=docker.io/$(IMG_NS)/$(parser-prefix)-zap" \
2222
--set="parser.image.tag=$(IMG_TAG)"
2323
kubectl apply -f ./integration-tests/automation-framework-configMap.yaml -n integration-tests
24-
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test --yes --package jest@$(JEST_VERSION) $(scanner)/integration-tests
24+
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests

test-base.mk

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ endif
3636
# IMG_TAG: Tag used to tag the newly created image. Defaults to the shortened commit hash
3737
# prefixed with `sha-` e.g. `sha-ef8de4b7`
3838
#
39-
# JEST_VERSION: Defines the jest version used for executing the tests. Defaults to latest
40-
#
4139
# KIND_CLUSTER_NAME: Defines the name of the kind cluster (created by kind create cluster --name cluster-name)
4240
#
4341
# Examples:
@@ -53,7 +51,6 @@ IMG_NS ?= securecodebox
5351
GIT_TAG ?= $$(git rev-parse --short HEAD)
5452
BASE_IMG_TAG ?= sha-$(GIT_TAG)
5553
IMG_TAG ?= "sha-$(GIT_TAG)"
56-
JEST_VERSION ?= 29.3.1
5754
KIND_CLUSTER_NAME ?= kind
5855

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

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

8178
.PHONY: install-deps-py
8279
install-deps-py:

0 commit comments

Comments
 (0)