@@ -78,11 +78,16 @@ EXEEXT := $(shell $(PYTHON) -c \
7878 "import sys; print('.exe' if sys.platform == 'win32' else '') ")
7979
8080NODE_EXE = node$(EXEEXT )
81- # Use $(PWD) so we can cd to anywhere before calling this
82- NODE ?= "$(PWD ) /$(NODE_EXE ) "
8381NODE_G_EXE = node_g$(EXEEXT )
8482NPM ?= ./deps/npm/bin/npm-cli.js
8583
84+ # Release build of node. Use $(PWD) so we can cd to anywhere before calling this
85+ NODE_REL ?= "$(PWD ) /$(NODE_EXE ) "
86+ # Prefer $(OUT_NODE) when using it to run tests. Prefer $(NODE_REL)
87+ # when using it to generate coverage reports or run toolings as
88+ # debug build is be slower.
89+ OUT_NODE = "$(PWD ) /out/$(BUILDTYPE ) /node$(EXEEXT ) "
90+
8691# Flags for packaging.
8792BUILD_DOWNLOAD_FLAGS ?= --download=all
8893BUILD_INTL_FLAGS ?= --with-intl=full-icu
9499
95100# Use -e to double check in case it's a broken link
96101available-node = \
97- if [ -x "$(NODE ) " ] && [ -e "$(NODE ) " ]; then \
98- "$(NODE ) " $(1 ) ; \
102+ if [ -x "$(NODE_REL ) " ] && [ -e "$(NODE_REL ) " ]; then \
103+ "$(NODE_REL ) " $(1 ) ; \
99104 elif [ -x ` command -v node ` ] && [ -e ` command -v node ` ] && [ ` command -v node ` ]; then \
100105 ` command -v node ` $(1 ) ; \
101106 else \
@@ -260,7 +265,7 @@ coverage-build: all ## Build coverage files.
260265coverage-build-js : # # Build JavaScript coverage files.
261266 mkdir -p node_modules
262267 if [ ! -d node_modules/c8 ]; then \
263- $(NODE ) ./deps/npm install c8 --no-save --no-package-lock; \
268+ $(NODE_REL ) ./deps/npm install c8 --no-save --no-package-lock; \
264269 fi
265270
266271.PHONY : coverage-test
@@ -287,13 +292,13 @@ coverage-test: coverage-build ## Run the tests and generate a coverage report.
287292.PHONY : coverage-report-js
288293coverage-report-js : # # Report JavaScript coverage results.
289294 -$(MAKE ) coverage-build-js
290- $(NODE ) ./node_modules/.bin/c8 report
295+ $(NODE_REL ) ./node_modules/.bin/c8 report
291296
292297.PHONY : cctest
293298
294299cctest : all # # Run the C++ tests using the built `cctest` executable.
295300 @out/$(BUILDTYPE ) /$@ --gtest_filter=$(GTEST_FILTER )
296- $(NODE ) ./test/embedding/test-embedding.js
301+ $(OUT_NODE ) ./test/embedding/test-embedding.js
297302
298303.PHONY : list-gtests
299304list-gtests : # # List all available C++ gtests.
@@ -385,7 +390,7 @@ test/addons/.docbuildstamp: $(DOCBUILDSTAMP_PREREQS) tools/doc/node_modules
385390 echo " Skipping .docbuildstamp (no crypto and/or no ICU)" ; \
386391 else \
387392 $(RM ) -r test/addons/?? _* /; \
388- [ -x $( NODE ) ] && $(NODE ) $< || node $< ; \
393+ [ -x $( NODE_REL ) ] && $(NODE_REL ) $< || node $< ; \
389394 [ $$ ? -eq 0 ] && touch $@ ; \
390395 fi
391396
@@ -605,7 +610,7 @@ test-ci: | clear-stalled bench-addons-build build-addons build-js-native-api-tes
605610 $(PYTHON ) tools/test.py $(PARALLEL_ARGS ) -p tap --logfile test.tap \
606611 --mode=$(BUILDTYPE_LOWER ) --flaky-tests=$(FLAKY_TESTS ) \
607612 $(TEST_CI_ARGS ) $(CI_JS_SUITES ) $(CI_NATIVE_SUITES ) $(CI_DOC )
608- $(NODE ) ./test/embedding/test-embedding.js
613+ $(OUT_NODE ) ./test/embedding/test-embedding.js
609614 $(info Clean up any leftover processes, error if found.)
610615 ps awwx | grep Release/node | grep -v grep | cat
611616 @PS_OUT=` ps awwx | grep Release/node | grep -v grep | awk ' {print $$1}' ` ; \
@@ -651,8 +656,8 @@ test-wpt: all ## Run the Web Platform Tests.
651656test-wpt-report : # # Run the Web Platform Tests and generate a report.
652657 $(RM ) -r out/wpt
653658 mkdir -p out/wpt
654- -WPT_REPORT=1 $(PYTHON ) tools/test.py --shell $(NODE ) $(PARALLEL_ARGS ) wpt
655- $(NODE ) " $$ PWD/tools/merge-wpt-reports.mjs"
659+ -WPT_REPORT=1 $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(PARALLEL_ARGS ) wpt
660+ $(NODE_REL ) " $$ PWD/tools/merge-wpt-reports.mjs"
656661
657662.PHONY : test-internet
658663test-internet : all # # Run internet tests.
@@ -672,7 +677,7 @@ test-doc: doc-only lint-md ## Build, lint, and verify the docs.
672677
673678.PHONY : test-doc-ci
674679test-doc-ci : doc-only # # Build, lint, and verify the docs (CI).
675- $(PYTHON ) tools/test.py --shell $(NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
680+ $(PYTHON ) tools/test.py --shell $(OUT_NODE ) $(TEST_CI_ARGS ) $(PARALLEL_ARGS ) doctool
676681
677682.PHONY : test-known-issues
678683test-known-issues : all # # Run tests for known issues.
@@ -681,11 +686,11 @@ test-known-issues: all ## Run tests for known issues.
681686# Related CI job: node-test-npm
682687.PHONY : test-npm
683688test-npm : $(NODE_EXE ) # # Run the npm test suite on deps/npm.
684- $(NODE ) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
689+ $(OUT_NODE ) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test
685690
686691.PHONY : test-npm-publish
687692test-npm-publish : $(NODE_EXE ) # # Test the `npm publish` command.
688- npm_package_config_publishtest=true $(NODE ) deps/npm/test/run.js
693+ npm_package_config_publishtest=true $(OUT_NODE ) deps/npm/test/run.js
689694
690695.PHONY : test-js-native-api
691696test-js-native-api : test-build-js-native-api # # Run JS Native-API tests.
@@ -1169,7 +1174,7 @@ endif
11691174 $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
11701175 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npm
11711176 unlink $(MACOSOUTDIR)/dist/node/usr/local/bin/npx
1172- $(NODE ) tools/license2rtf.mjs < LICENSE > \
1177+ $(NODE_REL ) tools/license2rtf.mjs < LICENSE > \
11731178 $(MACOSOUTDIR)/installer/productbuild/Resources/license.rtf
11741179 cp doc/osx_installer_logo.png $(MACOSOUTDIR)/installer/productbuild/Resources
11751180 pkgbuild --version $(FULLVERSION) \
0 commit comments