diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 73d671b0..5c017278 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -name: Check Lint/Style +name: Check Lint & Style on: [push, pull_request] jobs: check: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d21cca26..f325a852 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/CHANGES.md b/CHANGES.md index 459280c4..b64812ec 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/Makefile b/Makefile index ee958db8..1a04beca 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -18,7 +18,6 @@ endif ifeq ($(shell uname -s),Darwin) DTRACE_UP_IN_HERE=1 endif -NODEOPT ?= $(HOME)/opt #---- Files @@ -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. @@ -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 diff --git a/package-lock.json b/package-lock.json index 5b430141..e22ae156 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bunyan", - "version": "1.8.13", + "version": "1.8.14", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -590,9 +590,9 @@ "dev": true }, "is-my-json-valid": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.20.1.tgz", - "integrity": "sha512-KWo8x7CYK5goqyYFJM4ZmapN2DvIGKkx5C1WLHyo2Dcr4R9u4Y9ofpZxn5+LF/d0FHR3AeFcYxVlqIA2OOwuJA==", + "version": "2.20.4", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.20.4.tgz", + "integrity": "sha512-Ym0D5NOxJ+f+zzQHkLfu5n9B1134ra+KwskpDD86200xYQBsAb9OKX81eSsI4oKN9GNAhDAReS7t8Mxtih/l+A==", "dev": true, "requires": { "generate-function": "^2.0.0", @@ -696,9 +696,9 @@ "dev": true }, "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.1.0.tgz", + "integrity": "sha512-CXcRvMyTlnR53xMcKnuMzfCA5i/nfblTnnr74CZb6C4vG39eu6w51t7nKmU5MfLfbTgGItliNyjO/ciNPDqClg==", "dev": true }, "jsprim": { @@ -933,46 +933,39 @@ "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", "optional": true }, - "nodeunit": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/nodeunit/-/nodeunit-0.9.5.tgz", - "integrity": "sha1-C2MjaAB9lGUczwoYmZgHmC8HOGY=", - "dev": true, - "requires": { - "tap": "^7.0.0" - } - }, "nyc": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-7.1.0.tgz", - "integrity": "sha1-jhSXHzoV0au+x6xhDvVMuInp/7Q=", + "version": "10.3.2", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-10.3.2.tgz", + "integrity": "sha1-8n9NkfKp2zbCT1dP9cbv/wIz3kY=", "dev": true, "requires": { + "archy": "^1.0.0", "arrify": "^1.0.1", "caching-transform": "^1.0.0", "convert-source-map": "^1.3.0", + "debug-log": "^1.0.1", "default-require-extensions": "^1.0.0", "find-cache-dir": "^0.1.1", "find-up": "^1.1.2", "foreground-child": "^1.5.3", - "glob": "^7.0.3", - "istanbul-lib-coverage": "^1.0.0-alpha.4", - "istanbul-lib-hook": "^1.0.0-alpha.4", - "istanbul-lib-instrument": "^1.1.0-alpha.3", - "istanbul-lib-report": "^1.0.0-alpha.3", - "istanbul-lib-source-maps": "^1.0.0-alpha.10", - "istanbul-reports": "^1.0.0-alpha.8", + "glob": "^7.0.6", + "istanbul-lib-coverage": "^1.1.0", + "istanbul-lib-hook": "^1.0.6", + "istanbul-lib-instrument": "^1.7.1", + "istanbul-lib-report": "^1.1.0", + "istanbul-lib-source-maps": "^1.2.0", + "istanbul-reports": "^1.1.0", "md5-hex": "^1.2.0", + "merge-source-map": "^1.0.2", "micromatch": "^2.3.11", "mkdirp": "^0.5.0", - "pkg-up": "^1.0.0", "resolve-from": "^2.0.0", "rimraf": "^2.5.4", - "signal-exit": "^3.0.0", - "spawn-wrap": "^1.2.4", - "test-exclude": "^1.1.0", - "yargs": "^4.8.1", - "yargs-parser": "^2.4.1" + "signal-exit": "^3.0.1", + "spawn-wrap": "1.2.4", + "test-exclude": "^4.1.0", + "yargs": "^7.1.0", + "yargs-parser": "^5.0.0" }, "dependencies": { "align-text": { @@ -987,12 +980,12 @@ } }, "amdefine": { - "version": "1.0.0", + "version": "1.0.1", "bundled": true, "dev": true }, "ansi-regex": { - "version": "2.0.0", + "version": "2.1.1", "bundled": true, "dev": true }, @@ -1002,7 +995,15 @@ "dev": true }, "append-transform": { - "version": "0.3.0", + "version": "0.4.0", + "bundled": true, + "dev": true, + "requires": { + "default-require-extensions": "^1.0.0" + } + }, + "archy": { + "version": "1.0.0", "bundled": true, "dev": true }, @@ -1015,7 +1016,7 @@ } }, "arr-flatten": { - "version": "1.0.1", + "version": "1.0.3", "bundled": true, "dev": true }, @@ -1035,93 +1036,90 @@ "dev": true }, "babel-code-frame": { - "version": "6.11.0", + "version": "6.22.0", "bundled": true, "dev": true, "requires": { - "babel-runtime": "^6.0.0", "chalk": "^1.1.0", "esutils": "^2.0.2", - "js-tokens": "^2.0.0" + "js-tokens": "^3.0.0" } }, "babel-generator": { - "version": "6.11.4", + "version": "6.24.1", "bundled": true, "dev": true, "requires": { - "babel-messages": "^6.8.0", - "babel-runtime": "^6.9.0", - "babel-types": "^6.10.2", - "detect-indent": "^3.0.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", "lodash": "^4.2.0", - "source-map": "^0.5.0" + "source-map": "^0.5.0", + "trim-right": "^1.0.1" } }, "babel-messages": { - "version": "6.8.0", + "version": "6.23.0", "bundled": true, "dev": true, "requires": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" } }, "babel-runtime": { - "version": "6.9.2", + "version": "6.23.0", "bundled": true, "dev": true, "requires": { "core-js": "^2.4.0", - "regenerator-runtime": "^0.9.5" + "regenerator-runtime": "^0.10.0" } }, "babel-template": { - "version": "6.9.0", + "version": "6.24.1", "bundled": true, "dev": true, "requires": { - "babel-runtime": "^6.9.0", - "babel-traverse": "^6.9.0", - "babel-types": "^6.9.0", - "babylon": "^6.7.0", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1", + "babylon": "^6.11.0", "lodash": "^4.2.0" } }, "babel-traverse": { - "version": "6.11.4", + "version": "6.24.1", "bundled": true, "dev": true, "requires": { - "babel-code-frame": "^6.8.0", - "babel-messages": "^6.8.0", - "babel-runtime": "^6.9.0", - "babel-types": "^6.9.0", - "babylon": "^6.7.0", + "babel-code-frame": "^6.22.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1", + "babylon": "^6.15.0", "debug": "^2.2.0", - "globals": "^8.3.0", + "globals": "^9.0.0", "invariant": "^2.2.0", "lodash": "^4.2.0" } }, "babel-types": { - "version": "6.11.1", + "version": "6.24.1", "bundled": true, "dev": true, "requires": { - "babel-runtime": "^6.9.1", - "babel-traverse": "^6.9.0", + "babel-runtime": "^6.22.0", "esutils": "^2.0.2", "lodash": "^4.2.0", "to-fast-properties": "^1.0.1" } }, "babylon": { - "version": "6.8.4", + "version": "6.17.0", "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "^6.0.0" - } + "dev": true }, "balanced-match": { "version": "0.4.2", @@ -1129,7 +1127,7 @@ "dev": true }, "brace-expansion": { - "version": "1.1.6", + "version": "1.1.7", "bundled": true, "dev": true, "requires": { @@ -1210,12 +1208,9 @@ } }, "code-point-at": { - "version": "1.0.0", + "version": "1.1.0", "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } + "dev": true }, "commondir": { "version": "1.0.1", @@ -1228,7 +1223,7 @@ "dev": true }, "convert-source-map": { - "version": "1.3.0", + "version": "1.5.0", "bundled": true, "dev": true }, @@ -1238,7 +1233,7 @@ "dev": true }, "cross-spawn": { - "version": "4.0.0", + "version": "4.0.2", "bundled": true, "dev": true, "requires": { @@ -1247,13 +1242,18 @@ } }, "debug": { - "version": "2.2.0", + "version": "2.6.6", "bundled": true, "dev": true, "requires": { - "ms": "0.7.1" + "ms": "0.7.3" } }, + "debug-log": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, "decamelize": { "version": "1.2.0", "bundled": true, @@ -1268,24 +1268,15 @@ } }, "detect-indent": { - "version": "3.0.1", + "version": "4.0.0", "bundled": true, "dev": true, "requires": { - "get-stdin": "^4.0.1", - "minimist": "^1.1.0", - "repeating": "^1.1.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - } + "repeating": "^2.0.0" } }, "error-ex": { - "version": "1.3.0", + "version": "1.3.1", "bundled": true, "dev": true, "requires": { @@ -1327,7 +1318,7 @@ } }, "filename-regex": { - "version": "2.0.0", + "version": "2.0.1", "bundled": true, "dev": true }, @@ -1363,20 +1354,20 @@ } }, "for-in": { - "version": "0.1.5", + "version": "1.0.2", "bundled": true, "dev": true }, "for-own": { - "version": "0.1.4", + "version": "0.1.5", "bundled": true, "dev": true, "requires": { - "for-in": "^0.1.5" + "for-in": "^1.0.1" } }, "foreground-child": { - "version": "1.5.3", + "version": "1.5.6", "bundled": true, "dev": true, "requires": { @@ -1390,17 +1381,12 @@ "dev": true }, "get-caller-file": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "get-stdin": { - "version": "4.0.1", + "version": "1.0.2", "bundled": true, "dev": true }, "glob": { - "version": "7.0.5", + "version": "7.1.1", "bundled": true, "dev": true, "requires": { @@ -1430,17 +1416,17 @@ } }, "globals": { - "version": "8.18.0", + "version": "9.17.0", "bundled": true, "dev": true }, "graceful-fs": { - "version": "4.1.4", + "version": "4.1.11", "bundled": true, "dev": true }, "handlebars": { - "version": "4.0.5", + "version": "4.0.8", "bundled": true, "dev": true, "requires": { @@ -1474,7 +1460,7 @@ "dev": true }, "hosted-git-info": { - "version": "2.1.5", + "version": "2.4.2", "bundled": true, "dev": true }, @@ -1484,7 +1470,7 @@ "dev": true }, "inflight": { - "version": "1.0.5", + "version": "1.0.6", "bundled": true, "dev": true, "requires": { @@ -1493,12 +1479,12 @@ } }, "inherits": { - "version": "2.0.1", + "version": "2.0.3", "bundled": true, "dev": true }, "invariant": { - "version": "2.2.1", + "version": "2.2.2", "bundled": true, "dev": true, "requires": { @@ -1516,7 +1502,7 @@ "dev": true }, "is-buffer": { - "version": "1.1.3", + "version": "1.1.5", "bundled": true, "dev": true }, @@ -1552,7 +1538,7 @@ "dev": true }, "is-finite": { - "version": "1.0.1", + "version": "1.0.2", "bundled": true, "dev": true, "requires": { @@ -1604,7 +1590,7 @@ "dev": true }, "isexe": { - "version": "1.1.2", + "version": "2.0.0", "bundled": true, "dev": true }, @@ -1617,46 +1603,45 @@ } }, "istanbul-lib-coverage": { - "version": "1.0.0-alpha.4", + "version": "1.1.0", "bundled": true, "dev": true }, "istanbul-lib-hook": { - "version": "1.0.0-alpha.4", + "version": "1.0.6", "bundled": true, "dev": true, "requires": { - "append-transform": "^0.3.0" + "append-transform": "^0.4.0" } }, "istanbul-lib-instrument": { - "version": "1.1.0-alpha.4", + "version": "1.7.1", "bundled": true, "dev": true, "requires": { - "babel-generator": "^6.11.3", - "babel-template": "^6.9.0", - "babel-traverse": "^6.9.0", - "babel-types": "^6.10.2", - "babylon": "^6.8.1", - "istanbul-lib-coverage": "^1.0.0-alpha.4" + "babel-generator": "^6.18.0", + "babel-template": "^6.16.0", + "babel-traverse": "^6.18.0", + "babel-types": "^6.18.0", + "babylon": "^6.13.0", + "istanbul-lib-coverage": "^1.1.0", + "semver": "^5.3.0" } }, "istanbul-lib-report": { - "version": "1.0.0-alpha.3", + "version": "1.1.0", "bundled": true, "dev": true, "requires": { - "async": "^1.4.2", - "istanbul-lib-coverage": "^1.0.0-alpha", + "istanbul-lib-coverage": "^1.1.0", "mkdirp": "^0.5.1", "path-parse": "^1.0.5", - "rimraf": "^2.4.3", "supports-color": "^3.1.2" }, "dependencies": { "supports-color": { - "version": "3.1.2", + "version": "3.2.3", "bundled": true, "dev": true, "requires": { @@ -1666,18 +1651,19 @@ } }, "istanbul-lib-source-maps": { - "version": "1.0.0-alpha.10", + "version": "1.2.0", "bundled": true, "dev": true, "requires": { - "istanbul-lib-coverage": "^1.0.0-alpha.0", + "debug": "^2.6.3", + "istanbul-lib-coverage": "^1.1.0", "mkdirp": "^0.5.1", - "rimraf": "^2.4.4", + "rimraf": "^2.6.1", "source-map": "^0.5.3" } }, "istanbul-reports": { - "version": "1.0.0-alpha.8", + "version": "1.1.0", "bundled": true, "dev": true, "requires": { @@ -1685,16 +1671,21 @@ } }, "js-tokens": { - "version": "2.0.0", + "version": "3.0.1", + "bundled": true, + "dev": true + }, + "jsesc": { + "version": "1.3.0", "bundled": true, "dev": true }, "kind-of": { - "version": "3.0.3", + "version": "3.2.0", "bundled": true, "dev": true, "requires": { - "is-buffer": "^1.0.2" + "is-buffer": "^1.1.5" } }, "lazy-cache": { @@ -1724,26 +1715,7 @@ } }, "lodash": { - "version": "4.13.1", - "bundled": true, - "dev": true - }, - "lodash.assign": { - "version": "4.0.9", - "bundled": true, - "dev": true, - "requires": { - "lodash.keys": "^4.0.0", - "lodash.rest": "^4.0.0" - } - }, - "lodash.keys": { - "version": "4.0.7", - "bundled": true, - "dev": true - }, - "lodash.rest": { - "version": "4.0.3", + "version": "4.17.4", "bundled": true, "dev": true }, @@ -1754,22 +1726,15 @@ "optional": true }, "loose-envify": { - "version": "1.2.0", + "version": "1.3.1", "bundled": true, "dev": true, "requires": { - "js-tokens": "^1.0.1" - }, - "dependencies": { - "js-tokens": { - "version": "1.0.3", - "bundled": true, - "dev": true - } + "js-tokens": "^3.0.0" } }, "lru-cache": { - "version": "4.0.1", + "version": "4.0.2", "bundled": true, "dev": true, "requires": { @@ -1790,6 +1755,14 @@ "bundled": true, "dev": true }, + "merge-source-map": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "requires": { + "source-map": "^0.5.3" + } + }, "micromatch": { "version": "2.3.11", "bundled": true, @@ -1811,7 +1784,7 @@ } }, "minimatch": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, "dev": true, "requires": { @@ -1832,12 +1805,12 @@ } }, "ms": { - "version": "0.7.1", + "version": "0.7.3", "bundled": true, "dev": true }, "normalize-package-data": { - "version": "2.3.5", + "version": "2.3.8", "bundled": true, "dev": true, "requires": { @@ -1848,26 +1821,34 @@ } }, "normalize-path": { - "version": "2.0.1", + "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } }, "number-is-nan": { - "version": "1.0.0", + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", "bundled": true, "dev": true }, "object.omit": { - "version": "2.0.0", + "version": "2.0.1", "bundled": true, "dev": true, "requires": { - "for-own": "^0.1.3", + "for-own": "^0.1.4", "is-extendable": "^0.1.1" } }, "once": { - "version": "1.3.3", + "version": "1.4.0", "bundled": true, "dev": true, "requires": { @@ -1884,7 +1865,7 @@ } }, "os-homedir": { - "version": "1.0.1", + "version": "1.0.2", "bundled": true, "dev": true }, @@ -1924,7 +1905,7 @@ } }, "path-is-absolute": { - "version": "1.0.0", + "version": "1.0.1", "bundled": true, "dev": true }, @@ -1969,14 +1950,6 @@ "find-up": "^1.0.0" } }, - "pkg-up": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "find-up": "^1.0.0" - } - }, "preserve": { "version": "0.2.0", "bundled": true, @@ -1988,7 +1961,7 @@ "dev": true }, "randomatic": { - "version": "1.1.5", + "version": "1.1.6", "bundled": true, "dev": true, "requires": { @@ -2016,7 +1989,7 @@ } }, "regenerator-runtime": { - "version": "0.9.5", + "version": "0.10.5", "bundled": true, "dev": true }, @@ -2029,18 +2002,23 @@ "is-primitive": "^2.0.0" } }, + "remove-trailing-separator": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, "repeat-element": { "version": "1.1.2", "bundled": true, "dev": true }, "repeat-string": { - "version": "1.5.4", + "version": "1.6.1", "bundled": true, "dev": true }, "repeating": { - "version": "1.1.3", + "version": "2.0.1", "bundled": true, "dev": true, "requires": { @@ -2072,7 +2050,7 @@ } }, "rimraf": { - "version": "2.5.4", + "version": "2.6.1", "bundled": true, "dev": true, "requires": { @@ -2090,7 +2068,7 @@ "dev": true }, "signal-exit": { - "version": "3.0.0", + "version": "3.0.2", "bundled": true, "dev": true }, @@ -2132,27 +2110,18 @@ "spdx-license-ids": "^1.0.2" } }, - "spdx-exceptions": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, "spdx-expression-parse": { - "version": "1.0.2", + "version": "1.0.4", "bundled": true, - "dev": true, - "requires": { - "spdx-exceptions": "^1.0.4", - "spdx-license-ids": "^1.0.0" - } + "dev": true }, "spdx-license-ids": { - "version": "1.2.1", + "version": "1.2.2", "bundled": true, "dev": true }, "string-width": { - "version": "1.0.1", + "version": "1.0.2", "bundled": true, "dev": true, "requires": { @@ -2183,40 +2152,38 @@ "dev": true }, "test-exclude": { - "version": "1.1.0", + "version": "4.1.0", "bundled": true, "dev": true, "requires": { "arrify": "^1.0.1", - "lodash.assign": "^4.0.9", - "micromatch": "^2.3.8", + "micromatch": "^2.3.11", + "object-assign": "^4.1.0", "read-pkg-up": "^1.0.1", "require-main-filename": "^1.0.1" } }, "to-fast-properties": { - "version": "1.0.2", + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "trim-right": { + "version": "1.0.1", "bundled": true, "dev": true }, "uglify-js": { - "version": "2.7.0", + "version": "2.8.22", "bundled": true, "dev": true, "optional": true, "requires": { - "async": "~0.2.6", "source-map": "~0.5.1", "uglify-to-browserify": "~1.0.0", "yargs": "~3.10.0" }, "dependencies": { - "async": { - "version": "0.2.10", - "bundled": true, - "dev": true, - "optional": true - }, "yargs": { "version": "3.10.0", "bundled": true, @@ -2247,11 +2214,11 @@ } }, "which": { - "version": "1.2.10", + "version": "1.2.14", "bundled": true, "dev": true, "requires": { - "isexe": "^1.1.1" + "isexe": "^2.0.0" } }, "which-module": { @@ -2271,11 +2238,12 @@ "dev": true }, "wrap-ansi": { - "version": "2.0.0", + "version": "2.1.0", "bundled": true, "dev": true, "requires": { - "string-width": "^1.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" } }, "wrappy": { @@ -2284,11 +2252,11 @@ "dev": true }, "write-file-atomic": { - "version": "1.1.4", + "version": "1.3.4", "bundled": true, "dev": true, "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", "slide": "^1.1.5" } @@ -2299,31 +2267,35 @@ "dev": true }, "yallist": { - "version": "2.0.0", + "version": "2.1.2", "bundled": true, "dev": true }, "yargs": { - "version": "4.8.1", + "version": "7.1.0", "bundled": true, "dev": true, "requires": { + "camelcase": "^3.0.0", "cliui": "^3.2.0", "decamelize": "^1.1.1", "get-caller-file": "^1.0.1", - "lodash.assign": "^4.0.3", "os-locale": "^1.4.0", "read-pkg-up": "^1.0.1", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", - "string-width": "^1.0.1", + "string-width": "^1.0.2", "which-module": "^1.0.0", - "window-size": "^0.2.0", "y18n": "^3.2.1", - "yargs-parser": "^2.4.1" + "yargs-parser": "^5.0.0" }, "dependencies": { + "camelcase": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, "cliui": { "version": "3.2.0", "bundled": true, @@ -2333,21 +2305,15 @@ "strip-ansi": "^3.0.1", "wrap-ansi": "^2.0.0" } - }, - "window-size": { - "version": "0.2.0", - "bundled": true, - "dev": true } } }, "yargs-parser": { - "version": "2.4.1", + "version": "5.0.0", "bundled": true, "dev": true, "requires": { - "camelcase": "^3.0.0", - "lodash.assign": "^4.0.6" + "camelcase": "^3.0.0" }, "dependencies": { "camelcase": { @@ -2673,9 +2639,9 @@ "dev": true }, "tap": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/tap/-/tap-7.1.2.tgz", - "integrity": "sha1-36w+zxSshUe7rSW70Wzyw3Q/Zc8=", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/tap/-/tap-9.0.3.tgz", + "integrity": "sha1-vT3uy1B/TjaEhu66jxDNePQvcoM=", "dev": true, "requires": { "bluebird": "^3.3.1", @@ -2687,16 +2653,16 @@ "glob": "^7.0.0", "isexe": "^1.0.0", "js-yaml": "^3.3.1", - "nyc": "^7.1.0", + "nyc": "^10.0.0", "only-shallow": "^1.0.2", "opener": "^1.4.1", "os-homedir": "1.0.1", "readable-stream": "^2.0.2", "signal-exit": "^3.0.0", "stack-utils": "^0.4.0", - "tap-mocha-reporter": "^2.0.0", - "tap-parser": "^2.2.0", - "tmatch": "^2.0.1" + "tap-mocha-reporter": "^3.0.1", + "tap-parser": "^4.2.2", + "tmatch": "^3.0.0" }, "dependencies": { "glob": { @@ -2716,9 +2682,9 @@ } }, "tap-mocha-reporter": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-2.0.1.tgz", - "integrity": "sha1-xwMWFz1uOhbFjhupLV1s2N5YoS4=", + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-3.0.9.tgz", + "integrity": "sha512-VO07vhC9EG27EZdOe7bWBj1ldbK+DL9TnRadOgdQmiQOVZjFpUEQuuqO7+rNSO2kfmkq5hWeluYXDWNG/ytXTQ==", "dev": true, "requires": { "color-support": "^1.1.0", @@ -2728,7 +2694,7 @@ "glob": "^7.0.5", "js-yaml": "^3.3.1", "readable-stream": "^2.1.5", - "tap-parser": "^2.0.0", + "tap-parser": "^5.1.0", "unicode-length": "^1.0.0" }, "dependencies": { @@ -2745,13 +2711,24 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "tap-parser": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-5.4.0.tgz", + "integrity": "sha512-BIsIaGqv7uTQgTW1KLTMNPSEQf4zDDPgYOBRdgOfuB+JFOLRBfEu6cLa/KvMvmqggu1FKXDfitjLwsq4827RvA==", + "dev": true, + "requires": { + "events-to-array": "^1.0.1", + "js-yaml": "^3.2.7", + "readable-stream": "^2" + } } } }, "tap-parser": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-2.2.3.tgz", - "integrity": "sha1-rebpbje/04zg8WLaBn80A08GiwE=", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-4.2.4.tgz", + "integrity": "sha1-ZaKmAuSeF9uD+h8pX1P60DAlzE0=", "dev": true, "requires": { "events-to-array": "^1.0.1", @@ -2770,9 +2747,9 @@ } }, "tmatch": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tmatch/-/tmatch-2.0.1.tgz", - "integrity": "sha1-DFYkbzPzDaG409colauvFmYPOM8=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tmatch/-/tmatch-3.1.0.tgz", + "integrity": "sha512-W3MSATOCN4pVu2qFxmJLIArSifeSOFqnfx9hiUaVgOmeRoI2NbU7RNga+6G+L8ojlFeQge+ZPCclWyUpQ8UeNQ==", "dev": true }, "to-object-path": { diff --git a/package.json b/package.json index 92ee2380..0a6416a3 100644 --- a/package.json +++ b/package.json @@ -36,15 +36,14 @@ "moment": "^2.19.3" }, "devDependencies": { - "nodeunit": "0.9", "ben": "0.0.0", "markdown-toc": "0.12.x", - "verror": "1.3.3", - "vasync": "1.4.3" + "tap": "^9.0.3", + "vasync": "1.4.3", + "verror": "1.3.3" }, "scripts": { "check": "make check", - "test": "nodeunit test/*.test.js # skip dtrace tests" - }, - "dependencies": {} + "test": "tap test/*.test.js # skip dtrace tests" + } } diff --git a/test/add-stream.test.js b/test/add-stream.test.js index 757274f2..d463d682 100644 --- a/test/add-stream.test.js +++ b/test/add-stream.test.js @@ -4,13 +4,9 @@ * Test stream adding. */ -var bunyan = require('../lib/bunyan'); +var test = require('tap').test; -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var test = tap4nodeunit.test; +var bunyan = require('../lib/bunyan'); test('non-writables passed as stream', function (t) { diff --git a/test/buffer.test.js b/test/buffer.test.js index 53c63762..ab74832b 100644 --- a/test/buffer.test.js +++ b/test/buffer.test.js @@ -1,6 +1,6 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. - * Copyright (c) 2012 Joyent Inc. All rights reserved. + * Copyright 2020 Trent Mick + * Copyright 2012 Joyent Inc. * * Test logging with (accidental) usage of buffers. */ @@ -8,16 +8,9 @@ var util = require('util'), inspect = util.inspect, format = util.format; -var bunyan = require('../lib/bunyan'); - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; +var bunyan = require('../lib/bunyan'); function Catcher() { @@ -41,7 +34,7 @@ var log = new bunyan.createLogger({ test('log.info(BUFFER)', function (t) { - var b = new Buffer('foo'); + var b = Buffer.from ? Buffer.from('foo') : new Buffer('foo'); ['trace', 'debug', @@ -69,7 +62,7 @@ test('log.info(BUFFER)', function (t) { //test('log.info({buf: BUFFER})', function (t) { -// var b = new Buffer('foo'); +// var b = Buffer.from ? Buffer.from('foo') : new Buffer('foo'); // // // Really there isn't much Bunyan can do here. See // // . An unwelcome hack would diff --git a/test/child-behaviour.test.js b/test/child-behaviour.test.js index ddc2896b..b882ec98 100644 --- a/test/child-behaviour.test.js +++ b/test/child-behaviour.test.js @@ -1,19 +1,12 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test some `.child(...)` behaviour. */ -var bunyan = require('../lib/bunyan'); - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; +var bunyan = require('../lib/bunyan'); function CapturingStream(recs) { diff --git a/test/cli-client-req.test.js b/test/cli-client-req.test.js index ce952602..ac544f60 100644 --- a/test/cli-client-req.test.js +++ b/test/cli-client-req.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Trent Mick. + * Copyright 2020 Trent Mick * * Test the bunyan CLI's handling of the "client_req" field. * "client_req" is a common-ish Bunyan log field from restify-clients. See: @@ -9,22 +9,18 @@ var exec = require('child_process').exec; var fs = require('fs'); +var os = require('os'); var path = require('path'); var _ = require('util').format; -var vasync = require('vasync'); - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; // ---- globals var BUNYAN = path.resolve(__dirname, '../bin/bunyan'); +if (os.platform() === 'win32') { + BUNYAN = process.execPath + ' ' + BUNYAN; +} // ---- tests diff --git a/test/cli-res.test.js b/test/cli-res.test.js index 75cb5dde..923ea7ff 100644 --- a/test/cli-res.test.js +++ b/test/cli-res.test.js @@ -1,27 +1,23 @@ /* - * Copyright (c) 2017, Trent Mick. + * Copyright 2020 Trent Mick * * Test the bunyan CLI's handling of the "res" field. */ var exec = require('child_process').exec; var fs = require('fs'); +var os = require('os'); var path = require('path'); var _ = require('util').format; -var vasync = require('vasync'); - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; // ---- globals var BUNYAN = path.resolve(__dirname, '../bin/bunyan'); +if (os.platform() === 'win32') { + BUNYAN = process.execPath + ' ' + BUNYAN; +} // ---- tests diff --git a/test/cli.test.js b/test/cli.test.js index 99ba9b9e..0318d969 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test the `bunyan` CLI. */ @@ -7,22 +7,19 @@ var p = console.warn; var exec = require('child_process').exec; var fs = require('fs'); +var os = require('os'); var path = require('path'); var _ = require('util').format; +var test = require('tap').test; var vasync = require('vasync'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - // ---- globals var BUNYAN = path.resolve(__dirname, '../bin/bunyan'); +if (os.platform() === 'win32') { + BUNYAN = process.execPath + ' ' + BUNYAN; +} // ---- support stuff @@ -99,50 +96,64 @@ test('cat simple.log', function (t) { ); }); -// A stable 'TZ' for 'local' timezone output. -tzEnv = objCopy(process.env); -tzEnv.TZ = 'Pacific/Honolulu'; - -test('time: simple.log local long', function (t) { - exec(_('%s -o long -L %s/corpus/simple.log', BUNYAN, __dirname), - {env: tzEnv}, function (err, stdout, stderr) { - t.ifError(err) - t.equal(stdout, - // JSSTYLED - '[2012-02-08T12:56:52.856-10:00] INFO: myservice/123 on example.com: ' - + 'My message\n'); - t.end(); +// Test some local/UTC time handling by changing to a known non-UTC timezone +// for some tests. +// +// I don't know how to effectively do this on Windows (at least +// https://stackoverflow.com/questions/2611017 concurs), so we skip these on +// Windows. Help is welcome if you know how to do this on Windows. +test('time TZ tests', { + skip: os.platform() === 'win32' + ? 'do not know how to set timezone on Windows' : false +}, function (suite) { + // A stable 'TZ' for 'local' timezone output. + tzEnv = objCopy(process.env); + tzEnv.TZ = 'Pacific/Honolulu'; + + test('time: simple.log local long', function (t) { + exec(_('%s -o long -L %s/corpus/simple.log', BUNYAN, __dirname), + {env: tzEnv}, function (err, stdout, stderr) { + t.ifError(err) + t.equal(stdout, + // JSSTYLED + '[2012-02-08T12:56:52.856-10:00] INFO: myservice/123 on example.com: ' + + 'My message\n'); + t.end(); + }); }); -}); -test('time: simple.log utc long', function (t) { - exec(_('%s -o long --time utc %s/corpus/simple.log', BUNYAN, __dirname), - {env: tzEnv}, function (err, stdout, stderr) { - t.ifError(err) - t.equal(stdout, - '[2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: ' - + 'My message\n'); - t.end(); + test('time: simple.log utc long', function (t) { + exec(_('%s -o long --time utc %s/corpus/simple.log', BUNYAN, __dirname), + {env: tzEnv}, function (err, stdout, stderr) { + t.ifError(err) + t.equal(stdout, + // JSSTYLED + '[2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: ' + + 'My message\n'); + t.end(); + }); }); -}); -test('time: simple.log local short', function (t) { - exec(_('%s -o short -L %s/corpus/simple.log', BUNYAN, __dirname), - {env: tzEnv}, function (err, stdout, stderr) { - t.ifError(err) - t.equal(stdout, - '12:56:52.856 INFO myservice: ' - + 'My message\n'); - t.end(); + test('time: simple.log local short', function (t) { + exec(_('%s -o short -L %s/corpus/simple.log', BUNYAN, __dirname), + {env: tzEnv}, function (err, stdout, stderr) { + t.ifError(err) + t.equal(stdout, + '12:56:52.856 INFO myservice: ' + + 'My message\n'); + t.end(); + }); }); -}); -test('time: simple.log utc short', function (t) { - exec(_('%s -o short %s/corpus/simple.log', BUNYAN, __dirname), - {env: tzEnv}, function (err, stdout, stderr) { - t.ifError(err) - t.equal(stdout, - '22:56:52.856Z INFO myservice: ' - + 'My message\n'); - t.end(); + test('time: simple.log utc short', function (t) { + exec(_('%s -o short %s/corpus/simple.log', BUNYAN, __dirname), + {env: tzEnv}, function (err, stdout, stderr) { + t.ifError(err) + t.equal(stdout, + '22:56:52.856Z INFO myservice: ' + + 'My message\n'); + t.end(); + }); }); + + suite.end(); }); test('simple.log with color', function (t) { @@ -221,12 +232,16 @@ test('simple.log doesnotexist1.log doesnotexist2.log', function (t) { // ENOENT, open 'asdf.log' // io.js 2.2 (at least): // ENOENT: no such file or directory, open 'doesnotexist1.log' + // in GitHub Actions windows-latest runner: + // JSSTYLED + // ENOENT: no such file or directory, open 'D:\\a\\node-bunyan\\node-bunyan\\doesnotexist1.log var matches = [ - /^bunyan: ENOENT.*?, open 'doesnotexist1.log'/m, - /^bunyan: ENOENT.*?, open 'doesnotexist2.log'/m, + /^bunyan: ENOENT.*?, open '.*?doesnotexist1.log'/m, + /^bunyan: ENOENT.*?, open '.*?doesnotexist2.log'/m, ]; matches.forEach(function (match) { - t.ok(match.test(stderr), 'stderr matches ' + match.toString()); + t.ok(match.test(stderr), 'stderr matches ' + match.toString() + + ', stderr=' + JSON .stringify(stderr)); }); t.end(); } @@ -390,7 +405,7 @@ test('--condition "this.level === TRACE', function (t) { exec(cmd, function (err, stdout, stderr) { t.ifError(err); t.equal(stdout, expect); - t.done(); + t.end(); }); }); diff --git a/test/ctor.test.js b/test/ctor.test.js index f47cb9dc..0f1164d9 100644 --- a/test/ctor.test.js +++ b/test/ctor.test.js @@ -1,20 +1,13 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test type checking on creation of the Logger. */ -var bunyan = require('../lib/bunyan'), - Logger = bunyan; - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; +var bunyan = require('../lib/bunyan') +var Logger = bunyan; test('ensure Logger creation options', function (t) { diff --git a/test/cycles.test.js b/test/cycles.test.js index 293de788..1c1d29d0 100644 --- a/test/cycles.test.js +++ b/test/cycles.test.js @@ -5,14 +5,7 @@ */ var Logger = require('../lib/bunyan.js'); - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var test = require('tap').test; var Stream = require('stream').Stream; @@ -99,6 +92,7 @@ test('cycles', function (t) { log.info('kaboom', obj.KABOOM); log.info(obj); - outstr.end(); t.ok('did not throw'); + + outstr.end(); }); diff --git a/test/dtrace/dtrace.test.js b/test/dtrace/dtrace.test.js index a9ea27b9..a1d4b719 100644 --- a/test/dtrace/dtrace.test.js +++ b/test/dtrace/dtrace.test.js @@ -1,22 +1,15 @@ /* - * Copyright 2016 Trent Mick + * Copyright 2020 Trent Mick * * If available, test dtrace support. */ var spawn = require('child_process').spawn; var format = require('util').format; +var test = require('tap').test; var bunyan = require('../../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/../tap4nodeunit.js']) - delete require.cache[__dirname + '/../tap4nodeunit.js']; -var tap4nodeunit = require('../tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - // Determine if we can run the dtrace tests. var dtracePlats = ['sunos', 'darwin', 'freebsd']; diff --git a/test/error-event.test.js b/test/error-event.test.js index 2318d425..0052d534 100644 --- a/test/error-event.test.js +++ b/test/error-event.test.js @@ -1,23 +1,16 @@ /* - * Copyright 2016 Trent Mick + * Copyright 2020 Trent Mick * * Test emission and handling of 'error' event in a logger with a 'path' * stream. */ var EventEmitter = require('events').EventEmitter; +var test = require('tap').test; var util = require('util'); var bunyan = require('../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - var BOGUS_PATH = '/this/path/is/bogus.log'; diff --git a/test/level.test.js b/test/level.test.js index ab619f27..b39f28bf 100644 --- a/test/level.test.js +++ b/test/level.test.js @@ -1,9 +1,10 @@ /* - * Copyright (c) 2014 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test the `log.level(...)`. */ +var test = require('tap').test; var util = require('util'), format = util.format, inspect = util.inspect; @@ -11,14 +12,6 @@ var p = console.log; var bunyan = require('../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - // ---- test boolean `log.()` calls diff --git a/test/log.test.js b/test/log.test.js index 55906513..f86f75f9 100644 --- a/test/log.test.js +++ b/test/log.test.js @@ -1,5 +1,5 @@ /* - * Copyright 2020 Trent Mick. + * Copyright 2020 Trent Mick * * Test the `log.trace(...)`, `log.debug(...)`, ..., `log.fatal(...)` API. */ @@ -7,18 +7,11 @@ var util = require('util'), format = util.format, inspect = util.inspect; +var test = require('tap').test; var p = console.log; var bunyan = require('../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - // ---- test boolean `log.()` calls diff --git a/test/other-api.test.js b/test/other-api.test.js index 0d9304b4..0649fa3d 100644 --- a/test/other-api.test.js +++ b/test/other-api.test.js @@ -1,18 +1,12 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test other parts of the exported API. */ -var bunyan = require('../lib/bunyan'); +var test = require('tap').test; -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var bunyan = require('../lib/bunyan'); test('bunyan.s', function (t) { diff --git a/test/process-exit.test.js b/test/process-exit.test.js index 2b7a6214..46454e17 100644 --- a/test/process-exit.test.js +++ b/test/process-exit.test.js @@ -8,12 +8,7 @@ */ var exec = require('child_process').exec; - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var test = tap4nodeunit.test; +var test = require('tap').test; var nodeVer = process.versions.node.split('.').map(Number); diff --git a/test/raw-stream.test.js b/test/raw-stream.test.js index 88432f39..104d7003 100644 --- a/test/raw-stream.test.js +++ b/test/raw-stream.test.js @@ -1,19 +1,13 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test `type: 'raw'` Logger streams. */ var format = require('util').format; -var Logger = require('../lib/bunyan'); +var test = require('tap').test; -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var Logger = require('../lib/bunyan'); function CapturingStream(recs) { diff --git a/test/ringbuffer.test.js b/test/ringbuffer.test.js index 79d193a4..08c88396 100644 --- a/test/ringbuffer.test.js +++ b/test/ringbuffer.test.js @@ -2,17 +2,11 @@ * Test the RingBuffer output stream. */ -var Logger = require('../lib/bunyan'); -var ringbuffer = new Logger.RingBuffer({ 'limit': 5 }); +var test = require('tap').test; -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var Logger = require('../lib/bunyan'); +var ringbuffer = new Logger.RingBuffer({ 'limit': 5 }); var log1 = new Logger({ name: 'log1', diff --git a/test/safe-json-stringify.test.js b/test/safe-json-stringify.test.js index 6b8dc400..e83247c4 100644 --- a/test/safe-json-stringify.test.js +++ b/test/safe-json-stringify.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * If available, use `safe-json-stringfy` as a fallback stringifier. * This covers the case where an enumerable property throws an error @@ -8,17 +8,8 @@ * See */ -var p = console.warn; var exec = require('child_process').exec; - -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; - +var test = require('tap').test; test('__defineGetter__ boom', function (t) { var cmd = process.execPath + ' ' + __dirname + '/safe-json-stringify-1.js'; diff --git a/test/serializers.test.js b/test/serializers.test.js index 1cddec02..c65ef66d 100644 --- a/test/serializers.test.js +++ b/test/serializers.test.js @@ -1,21 +1,14 @@ /* - * Copyright (c) 2012 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test the standard serializers in Bunyan. */ var http = require('http'); - -var bunyan = require('../lib/bunyan'); +var test = require('tap').test; var verror = require('verror'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var bunyan = require('../lib/bunyan'); function CapturingStream(recs) { diff --git a/test/src.test.js b/test/src.test.js index 43553d1c..82bc817d 100644 --- a/test/src.test.js +++ b/test/src.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Trent Mick. + * Copyright 2020 Trent Mick. * * Test `src: true` usage. */ @@ -7,17 +7,10 @@ // Intentionally on line 8 for tests below: function logSomething(log) { log.info('something'); } - +var test = require('tap').test; var format = require('util').format; -var Logger = require('../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var after = tap4nodeunit.after; -var before = tap4nodeunit.before; -var test = tap4nodeunit.test; +var Logger = require('../lib/bunyan'); function CapturingStream(recs) { diff --git a/test/stream-levels.test.js b/test/stream-levels.test.js index 6e12e095..93c86651 100644 --- a/test/stream-levels.test.js +++ b/test/stream-levels.test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Trent Mick. All rights reserved. + * Copyright 2020 Trent Mick * * Test that streams (the various way they can be added to * a Logger instance) get the appropriate level. @@ -8,16 +8,10 @@ var util = require('util'), format = util.format, inspect = util.inspect; -var p = console.log; +var test = require('tap').test; var bunyan = require('../lib/bunyan'); -// node-tap API -if (require.cache[__dirname + '/tap4nodeunit.js']) - delete require.cache[__dirname + '/tap4nodeunit.js']; -var tap4nodeunit = require('./tap4nodeunit.js'); -var test = tap4nodeunit.test; - // ---- Tests diff --git a/test/tap4nodeunit.js b/test/tap4nodeunit.js deleted file mode 100644 index 5c46e4db..00000000 --- a/test/tap4nodeunit.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012 Mark Cavage. All rights reserved. - * - * Help nodeunit API feel like node-tap's. - * - * Usage: - * if (require.cache[__dirname + '/tap4nodeunit.js']) - * delete require.cache[__dirname + '/tap4nodeunit.js']; - * var tap4nodeunit = require('./tap4nodeunit.js'); - * var after = tap4nodeunit.after; - * var before = tap4nodeunit.before; - * var test = tap4nodeunit.test; - */ - - - -//---- Exports - -module.exports = { - after: function after(teardown) { - module.parent.exports.tearDown = function _teardown(callback) { - try { - teardown.call(this, callback); - } catch (e) { - console.error('after:\n' + e.stack); - process.exit(1); - } - }; - }, - - before: function before(setup) { - module.parent.exports.setUp = function _setup(callback) { - try { - setup.call(this, callback); - } catch (e) { - console.error('before:\n' + e.stack); - process.exit(1); - } - }; - }, - - test: function test(name, tester) { - module.parent.exports[name] = function _(t) { - var _done = false; - t.end = function end() { - if (!_done) { - _done = true; - t.done(); - } - }; - t.notOk = function notOk(ok, message) { - return (t.ok(!ok, message)); - }; - t.error = t.ifError; - - tester.call(this, t); - }; - } - - -};