diff --git a/Makefile b/Makefile index 8c75dd1d31..ad68e1ddad 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +CMD_ARGS = $(filter-out $@,$(MAKECMDGOALS)) + +%: + @: + EXTENSIONS_DIR = ./extensions extensions = $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), ${dir}) extension_node_modules = $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), ${dir}/node_modules) @@ -9,6 +14,7 @@ else DETECTED_OS := $(shell uname) endif +.PHONY: binaries/client binaries/client: node_modules yarn download-bins @@ -34,7 +40,7 @@ lint: .PHONY: test test: binaries/client - yarn test + yarn run jest $(or $(CMD_ARGS), "src") .PHONY: integration-linux integration-linux: binaries/client build-extension-types build-extensions @@ -58,10 +64,6 @@ integration-win: binaries/client build-extension-types build-extensions yarn build:win yarn integration -.PHONY: test-app -test-app: - yarn test - .PHONY: build build: node_modules binaries/client build-extensions ifeq "$(DETECTED_OS)" "Windows" diff --git a/integration/__tests__/app.tests.ts b/integration/__tests__/app.tests.ts index af029a23e9..e744a24c74 100644 --- a/integration/__tests__/app.tests.ts +++ b/integration/__tests__/app.tests.ts @@ -1,3 +1,13 @@ +/** + * @jest-environment node + */ + +/* + Cluster tests are run if there is a pre-existing minikube cluster. Before running cluster tests the TEST_NAMESPACE + namespace is removed, if it exists, from the minikube cluster. Resources are created as part of the cluster tests in the + TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube + cluster and vice versa. +*/ import { Application } from "spectron"; import * as utils from "../helpers/utils"; import { listHelmRepositories } from "../helpers/utils"; diff --git a/package.json b/package.json index 661bd6d0b9..ce78da428b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "build:linux": "yarn run compile && electron-builder --linux --dir -c.productName=Lens", "build:mac": "yarn run compile && electron-builder --mac --dir -c.productName=Lens", "build:win": "yarn run compile && electron-builder --win --dir -c.productName=Lens", - "test": "scripts/test.sh", "integration": "jest --runInBand integration", "dist": "yarn run compile && electron-builder --publish onTag", "dist:win": "yarn run compile && electron-builder --publish onTag --x64 --ia32", @@ -35,7 +34,7 @@ "download:kubectl": "yarn run ts-node build/download_kubectl.ts", "download:helm": "yarn run ts-node build/download_helm.ts", "build:tray-icons": "yarn run ts-node build/build_tray_icon.ts", - "lint": "yarn run eslint $@ --ext js,ts,tsx --max-warnings=0 .", + "lint": "yarn run eslint --ext js,ts,tsx --max-warnings=0 .", "lint:fix": "yarn run lint --fix", "mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest", "verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict", @@ -51,7 +50,6 @@ "jest": { "collectCoverage": false, "verbose": true, - "testEnvironment": "node", "transform": { "^.+\\.tsx?$": "ts-jest" }, diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 19c1f71c47..0000000000 --- a/scripts/test.sh +++ /dev/null @@ -1 +0,0 @@ -jest --env=jsdom ${1:-src} diff --git a/src/common/__tests__/search-store.test.ts b/src/common/__tests__/search-store.test.ts index d361c858fd..a0e3eb7922 100644 --- a/src/common/__tests__/search-store.test.ts +++ b/src/common/__tests__/search-store.test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { SearchStore } from "../search-store"; let searchStore: SearchStore = null; diff --git a/src/renderer/components/+workloads-pods/__tests__/pod-tolerations.test.tsx b/src/renderer/components/+workloads-pods/__tests__/pod-tolerations.test.tsx index dbde813e5a..8071254940 100644 --- a/src/renderer/components/+workloads-pods/__tests__/pod-tolerations.test.tsx +++ b/src/renderer/components/+workloads-pods/__tests__/pod-tolerations.test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import React from "react"; import "@testing-library/jest-dom/extend-expect"; import { fireEvent, render } from "@testing-library/react"; diff --git a/src/renderer/components/dock/__test__/log-resource-selector.test.tsx b/src/renderer/components/dock/__test__/log-resource-selector.test.tsx index 22d97b7216..d373d0fbab 100644 --- a/src/renderer/components/dock/__test__/log-resource-selector.test.tsx +++ b/src/renderer/components/dock/__test__/log-resource-selector.test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import React from "react"; import "@testing-library/jest-dom/extend-expect"; import { render } from "@testing-library/react"; diff --git a/src/renderer/components/dock/__test__/log-tab.store.test.ts b/src/renderer/components/dock/__test__/log-tab.store.test.ts index 79b93af623..e99022070b 100644 --- a/src/renderer/components/dock/__test__/log-tab.store.test.ts +++ b/src/renderer/components/dock/__test__/log-tab.store.test.ts @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { podsStore } from "../../+workloads-pods/pods.store"; import { Pod } from "../../../api/endpoints"; import { dockStore } from "../dock.store";