Skip to content

Commit

Permalink
make internal js projects testing target
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin committed Oct 23, 2023
1 parent 71f7c9a commit c95ba15
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/app-test-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ jobs:
npm config set cache ${{ github.workspace }}/.npm-cache
yarn config set cache-folder ${{ github.workspace }}/.yarn-cache
make setup-js
- name: 'opentrons app frontendunit tests'
- name: 'test frontend packages'
run: |
make -C app test-cov
yarn jest --coverage=true --ci=true --collectCoverageFrom="app/src/**/*.(js|ts|tsx)" app/src components/src shared-data/js
- name: 'Upload coverage report'
uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -140,13 +140,9 @@ jobs:
npm config set cache ${{ github.workspace }}/.npm-cache
yarn config set cache-folder ${{ github.workspace }}/.yarn-cache
make setup-js
- name: 'test app shell'
run: make -C app-shell test-cov
- name: 'test app shell odd'
run: make -C app-shell-odd test-cov
- name: 'test discovery client'
run: make -C discovery-client test-cov
# TODO before merging: check to see that coverage report actually gets uploaded for each native package
- name: 'test native(er) packages'
run: |
make test-js-internal tests="app-shell/src app-shell-odd/src discovery-client/src" cov_opts="--coverage=true --ci=true --collectCoverageFrom='(app-shell|app-shell-odd| discovery-client)/src/**/*.(js|ts|tsx)'"
- name: 'Upload coverage report'
uses: 'codecov/codecov-action@v3'
with:
Expand Down
23 changes: 9 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ USB_BRIDGE_DIR := usb-bridge
NODE_USB_BRIDGE_CLIENT_DIR := usb-bridge/node-client

PYTHON_DIRS := $(API_DIR) $(UPDATE_SERVER_DIR) $(NOTIFY_SERVER_DIR) $(ROBOT_SERVER_DIR) $(SERVER_UTILS_DIR) $(SHARED_DATA_DIR)/python $(G_CODE_TESTING_DIR) $(HARDWARE_DIR) $(USB_BRIDGE_DIR)
JS_PACKAGES := $(API_CLIENT_DIR) $(APP_SHELL_DIR) $(APP_SHELL_ODD_DIR) $(COMPONENTS_DIR) $(DISCOVERY_CLIENT_DIR) $(LABWARE_LIBRARY_DIR) $(PROTOCOL_DESIGNER_DIR) $(SHARED_DATA_DIR) $(REACT_API_CLIENT_DIR) $(STEP_GENERATION_DIR) $(NODE_USB_BRIDGE_CLIENT_DIR)

# This may be set as an environment variable (and is by CI tasks that upload
# to test pypi) to add a .dev extension to the python package versions. If
Expand Down Expand Up @@ -198,18 +199,8 @@ test-py: test-py-windows
$(MAKE) -C $(USB_BRIDGE_DIR) test

.PHONY: test-js
test-js:
$(MAKE) -C $(API_CLIENT_DIR) test
$(MAKE) -C $(APP_SHELL_DIR) test
$(MAKE) -C $(APP_SHELL_ODD_DIR) test
$(MAKE) -C $(COMPONENTS_DIR) test
$(MAKE) -C $(DISCOVERY_CLIENT_DIR) test
$(MAKE) -C $(LABWARE_LIBRARY_DIR) test
$(MAKE) -C $(PROTOCOL_DESIGNER_DIR) test
$(MAKE) -C $(REACT_API_CLIENT_DIR) test
$(MAKE) -C $(SHARED_DATA_DIR) test
$(MAKE) -C $(STEP_GENERATION_DIR) test
$(MAKE) -C $(LABWARE_LIBRARY_DIR) test
test-js: tests?=$(JS_PACKAGES)
test-js: test-js-internal

# lints and typechecks
.PHONY: lint
Expand Down Expand Up @@ -271,6 +262,10 @@ circular-dependencies-js:
yarn madge $(and $(CI),--no-spinner --no-color) --circular app/src/index.tsx
yarn madge $(and $(CI),--no-spinner --no-color) --circular components/src/index.ts

.PHONY: test-js-%
test-js-%:
.PHONY: test-js-internal
test-js-internal:
yarn jest $(tests) $(test_opts) $(cov_opts)

.PHONY: test-js-%
test-js-%:
$(MAKE) test-js-internal tests="$(if $(tests),$(foreach test,$(tests),$*/$(test)),$*)" $(test_opts) $(cov_opts)
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ dev-shell-odd:

.PHONY: test
test:
make -C .. test-js-app tests=$(tests) test_opts="$(test_opts)"
make -C .. test-js-app tests="$(tests)" test_opts="$(test_opts)"

.PHONY: test-cov
test-cov:
Expand Down

0 comments on commit c95ba15

Please sign in to comment.