Skip to content

Commit 4ecc87d

Browse files
committed
Add recipe to run unit tests against specific Node.js versions
1 parent 699a1fa commit 4ecc87d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tools/make/lib/test/javascript.mk

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
# VARIABLES #
33

4+
# Define the command for setting executable permissions:
5+
MAKE_EXECUTABLE ?= chmod +x
6+
47
# Define the Node environment:
58
NODE_ENV_TEST ?= $(NODE_ENV)
69

@@ -10,6 +13,13 @@ NODE_PATH_TEST ?= $(NODE_PATH)
1013
# Define the test runner to use when running JavaScript tests:
1114
JAVASCRIPT_TEST_RUNNER ?= tape
1215

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+
1323

1424
# DEPENDENCIES #
1525

@@ -98,3 +108,14 @@ test-javascript-xunit: $(NODE_MODULES)
98108
done
99109

100110
.PHONY: test-javascript-xunit
111+
112+
113+
# Run unit tests against Node.js versions.
114+
#
115+
# This targets runs JavaScript unit tests against specific Node.js versions.
116+
117+
test-node-versions: $(NODE_MODULES)
118+
$(QUIET) $(MAKE_EXECUTABLE) $(JAVASCRIPT_TEST_NODE_VERSIONS)
119+
$(QUIET) $(JAVASCRIPT_TEST_NODE_VERSIONS) $(JAVASCRIPT_TEST_NODE_VERSIONS_FLAGS) $(TESTS)
120+
121+
.PHONY: test-node-versions

0 commit comments

Comments
 (0)