|
26 | 26 | BAIL=--bail
|
27 | 27 | endif
|
28 | 28 |
|
| 29 | +SLOW_NAMING_REGEX ?= \.slow\.test\.js$$ |
| 30 | + |
29 | 31 | REPLACEMENTS = "SF_SCHEMA SF_VERSION_FUNCTION SF_PACKAGE_VERSION SF_SHARE APP_ROLE"
|
30 | 32 | NATIVE_APP_REPLACEMENTS = "SF_APP_SCHEMA APP_ROLE"
|
31 | 33 |
|
32 | 34 | include $(COMMON_DIR)/Makefile
|
33 | 35 |
|
34 | 36 | .SILENT:
|
35 | 37 |
|
36 |
| -.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test remove remove-functions remove-share clean |
| 38 | +.PHONY: help lint build build-share build-native-app-setup-script deploy deploy-share test test-fast test-slow remove remove-functions remove-share clean |
37 | 39 |
|
38 | 40 | help:
|
39 | 41 | echo "Available targets: lint build deploy test remove remove-functions clean"
|
@@ -97,12 +99,36 @@ deploy-share: check build-share
|
97 | 99 |
|
98 | 100 | test: check $(NODE_MODULES_DEV)
|
99 | 101 | echo "Testing modules..."
|
| 102 | + $(MAKE) test-fast |
| 103 | + $(MAKE) test-slow |
| 104 | + |
| 105 | +test-fast: check $(NODE_MODULES_DEV) |
| 106 | + for m in $(shell ls $(TEST_DIR)); do \ |
| 107 | + TESTS=`$(COMMON_DIR)/list_functions.js $$m --diff="$(diff)" --modules=$(modules) --functions=$(functions)`; \ |
| 108 | + if [ ! -z "$$TESTS" ]; then \ |
| 109 | + FLAGS=`echo "$$TESTS" | tr ' ' '\n' | grep '^--global' | tr '\n' ' '`; \ |
| 110 | + TEST_FILES=`echo "$$TESTS" | tr ' ' '\n' | grep '\.test\.js$$'`; \ |
| 111 | + FAST_TESTS=`echo "$$TEST_FILES" | grep -Ev "$(SLOW_NAMING_REGEX)" | tr '\n' ' '`; \ |
| 112 | + if [ ! -z "$$FAST_TESTS" ]; then \ |
| 113 | + PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \ |
| 114 | + jest --testTimeout=50000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$FAST_TESTS $$FLAGS \ |
| 115 | + --setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \ |
| 116 | + fi; \ |
| 117 | + fi; \ |
| 118 | + done; |
| 119 | + |
| 120 | +test-slow: check $(NODE_MODULES_DEV) |
100 | 121 | for m in $(shell ls $(TEST_DIR)); do \
|
101 | 122 | TESTS=`$(COMMON_DIR)/list_functions.js $$m --diff="$(diff)" --modules=$(modules) --functions=$(functions)`; \
|
102 | 123 | if [ ! -z "$$TESTS" ]; then \
|
103 |
| - PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \ |
104 |
| - jest --testTimeout=50000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \ |
105 |
| - --setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \ |
| 124 | + FLAGS=`echo "$$TESTS" | tr ' ' '\n' | grep '^--global' | tr '\n' ' '`; \ |
| 125 | + TEST_FILES=`echo "$$TESTS" | tr ' ' '\n' | grep '\.test\.js$$'`; \ |
| 126 | + SLOW_TESTS=`echo "$$TEST_FILES" | grep -E "$(SLOW_NAMING_REGEX)" | tr '\n' ' '`; \ |
| 127 | + if [ ! -z "$$SLOW_TESTS" ]; then \ |
| 128 | + PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \ |
| 129 | + jest --runInBand --testTimeout=150000 $(BAIL) --verbose --slowTestThreshold=20 $$SLOW_TESTS $$FLAGS \ |
| 130 | + --setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \ |
| 131 | + fi; \ |
106 | 132 | fi; \
|
107 | 133 | done;
|
108 | 134 |
|
|
0 commit comments