Skip to content

Commit

Permalink
nodeunit -> node-tap for testing (#645)
Browse files Browse the repository at this point in the history
This uses node-tap v9 rather than the current latest because that is 
the last major version of node-tap that supports back to node v0.10.
This is a cherry-pick of #644.
  • Loading branch information
trentm authored Jul 8, 2020
1 parent a9fe41d commit 15547da
Show file tree
Hide file tree
Showing 27 changed files with 370 additions and 594 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check Lint/Style
name: Check Lint & Style
on: [push, pull_request]
jobs:
check:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ on:
jobs:
# Test once on every (available) plat, using LTS node version
# (https://nodejs.org/en/about/releases/).
#
# TODO: add windows-latest when moved to node-tap and don't have to
# rely on shell globbing
test-plats:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Known issues:

## not yet released

(nothing yet)
- Development change: Switch to node-tap for testing (from nodeunit, which is
now obsolete). Currently just tap v9 because that is the last major version
of node-tap that supports back to node v0.10.

## 1.8.14

Expand Down
44 changes: 5 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL := bash

#---- Tools

NODEUNIT := ./node_modules/.bin/nodeunit
TAP_EXEC := ./node_modules/.bin/tap
SUDO := sudo
ifeq ($(shell uname -s),SunOS)
# On SunOS (e.g. SmartOS) we expect to run the test suite as the
Expand All @@ -18,7 +18,6 @@ endif
ifeq ($(shell uname -s),Darwin)
DTRACE_UP_IN_HERE=1
endif
NODEOPT ?= $(HOME)/opt


#---- Files
Expand All @@ -28,7 +27,7 @@ JSSTYLE_FILES := $(shell find lib test tools examples -name "*.js") bin/bunyan

#---- Targets

all $(NODEUNIT):
all $(TAP_EXEC):
npm install $(NPM_INSTALL_FLAGS)

# Ensure all version-carrying files have the same version.
Expand Down Expand Up @@ -93,45 +92,12 @@ distclean:
#---- test

.PHONY: test
test: $(NODEUNIT)
test: $(TAP_EXEC)
test -z "$(DTRACE_UP_IN_HERE)" || test -n "$(SKIP_DTRACE)" || \
(node -e 'require("dtrace-provider").createDTraceProvider("isthisthingon")' && \
echo "\nNote: Use 'SKIP_DTRACE=1 make test' to skip parts of the test suite that require root." && \
$(SUDO) $(NODEUNIT) test/dtrace/*.test.js)
$(NODEUNIT) test/*.test.js # non-dtrace test files

# Test will all node supported versions (presumes install locations I use on
# my machine -- "~/opt/node-VER"):
# Note: 'test4' is last so (if all is well) I end up with a binary
# dtrace-provider build for my current default node version.
.PHONY: testall
testall: test7 test6 test012 test010 test4

.PHONY: test7
test7:
@echo "# Test node 7.x (with node `$(NODEOPT)/node-7/bin/node --version`)"
@$(NODEOPT)/node-7/bin/node --version | grep '^v7\.'
PATH="$(NODEOPT)/node-7/bin:$(PATH)" make distclean all test
.PHONY: test6
test6:
@echo "# Test node 6.x (with node `$(NODEOPT)/node-6/bin/node --version`)"
@$(NODEOPT)/node-6/bin/node --version | grep '^v6\.'
PATH="$(NODEOPT)/node-6/bin:$(PATH)" make distclean all test
.PHONY: test4
test4:
@echo "# Test node 4.x (with node `$(NODEOPT)/node-4/bin/node --version`)"
@$(NODEOPT)/node-4/bin/node --version | grep '^v4\.'
PATH="$(NODEOPT)/node-4/bin:$(PATH)" make distclean all test
.PHONY: test012
test012:
@echo "# Test node 0.12.x (with node `$(NODEOPT)/node-0.12/bin/node --version`)"
@$(NODEOPT)/node-0.12/bin/node --version | grep '^v0\.12\.'
PATH="$(NODEOPT)/node-0.12/bin:$(PATH)" make distclean all test
.PHONY: test010
test010:
@echo "# Test node 0.10.x (with node `$(NODEOPT)/node-0.10/bin/node --version`)"
@$(NODEOPT)/node-0.10/bin/node --version | grep '^v0\.10\.'
PATH="$(NODEOPT)/node-0.10/bin:$(PATH)" make distclean all test
$(SUDO) $(TAP_EXEC) test/dtrace/*.test.js)
$(TAP_EXEC) test/*.test.js


#---- check
Expand Down
Loading

0 comments on commit 15547da

Please sign in to comment.