Skip to content

Commit 3ae5fb3

Browse files
committed
Simplify recipes by using existing targets
1 parent e98550a commit 3ae5fb3

File tree

2 files changed

+3
-70
lines changed

2 files changed

+3
-70
lines changed

tools/make/lib/tools-test/Makefile

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11

2-
# VARIABLES #
3-
4-
# Define the path to the `tap-spec` executable:
5-
#
6-
# To install tap-spec:
7-
# $ npm install tap-spec
8-
#
9-
# [1]: https://github.com/scottcorgan/tap-spec
10-
TAP_REPORTER ?= $(BIN_DIR)/tap-spec
11-
12-
# Define the path to the `tap-summary` executable:
13-
#
14-
# To install tap-summary:
15-
# $ npm install tap-summary
16-
#
17-
# [1]: https://github.com/zoubin/tap-summary
18-
TAP_SUMMARY ?= $(BIN_DIR)/tap-summary
19-
20-
212
# DEPENDENCIES #
223

234
include $(TOOLS_MAKE_LIB_DIR)/tools-test/javascript.mk
Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,12 @@
11

2-
# VARIABLES #
3-
4-
# Define the command for setting executable permissions:
5-
MAKE_EXECUTABLE ?= chmod +x
6-
7-
# Define the Node environment:
8-
NODE_ENV_TEST ?= $(NODE_ENV)
9-
10-
# Define the Node path:
11-
NODE_PATH_TEST ?= $(NODE_PATH)
12-
13-
# Define the test runner to use when running JavaScript tests:
14-
JAVASCRIPT_TEST_RUNNER ?= tape
15-
16-
# Define test runner to use when running JavaScript tests across multiple Node.js versions:
17-
JAVASCRIPT_TEST_NODE_VERSIONS ?= $(TOOLS_DIR)/test/scripts/test_node_versions
18-
19-
# Define the command-line options to be used when invoking the versions runner:
20-
JAVASCRIPT_TEST_NODE_VERSIONS_FLAGS ?= \
21-
--versions $(NODE_VERSIONS)
22-
23-
24-
# DEPENDENCIES #
25-
26-
ifeq ($(JAVASCRIPT_TEST_RUNNER), tape)
27-
include $(TOOLS_MAKE_LIB_DIR)/test/tape.mk
28-
endif
29-
30-
312
# TARGETS #
323

334
# Run JavaScript unit tests.
345
#
356
# This target runs JavaScript unit tests using a specified test runner and pipes TAP output to a reporter.
367

378
tools-test-javascript: $(NODE_MODULES)
38-
$(QUIET) for test in $(TOOLS_TESTS); do \
39-
echo ''; \
40-
echo "Running test: $$test"; \
41-
NODE_ENV=$(NODE_ENV_TEST) \
42-
NODE_PATH=$(NODE_PATH_TEST) \
43-
$(JAVASCRIPT_TEST) \
44-
$(JAVASCRIPT_TEST_FLAGS) \
45-
$$test \
46-
| $(TAP_REPORTER) || exit 1; \
47-
done
9+
$(QUIET) TESTS="$(TOOLS_TESTS)" $(MAKE) -f $(this_file) test-javascript
4810

4911
.PHONY: tools-test-javascript
5012

@@ -54,16 +16,7 @@ tools-test-javascript: $(NODE_MODULES)
5416
# This target runs JavaScript unit tests and aggregates TAP output as a test summary.
5517

5618
tools-test-javascript-summary: $(NODE_MODULES)
57-
$(QUIET) for test in $(TOOLS_TESTS); do \
58-
echo ''; \
59-
echo "Running test: $$test"; \
60-
NODE_ENV=$(NODE_ENV_TEST) \
61-
NODE_PATH=$(NODE_PATH_TEST) \
62-
$(JAVASCRIPT_TEST) \
63-
$(JAVASCRIPT_TEST_FLAGS) \
64-
$$test \
65-
| $(TAP_SUMMARY) || exit 1; \
66-
done
19+
$(QUIET) TESTS="$(TOOLS_TESTS)" $(MAKE) -f $(this_file) test-javascript-summary
6720

6821
.PHONY: tools-test-javascript-summary
6922

@@ -73,7 +26,6 @@ tools-test-javascript-summary: $(NODE_MODULES)
7326
# This targets runs JavaScript unit tests against specific Node.js versions.
7427

7528
tools-test-node-versions: $(NODE_MODULES)
76-
$(QUIET) $(MAKE_EXECUTABLE) $(JAVASCRIPT_TEST_NODE_VERSIONS)
77-
$(QUIET) $(JAVASCRIPT_TEST_NODE_VERSIONS) $(JAVASCRIPT_TEST_NODE_VERSIONS_FLAGS) $(TOOLS_TESTS)
29+
$(QUIET) TESTS="$(TOOLS_TESTS)" $(MAKE) -f $(this_file) test-node-versions
7830

7931
.PHONY: tools-test-node-versions

0 commit comments

Comments
 (0)