From a52c6eb9e8f8efebcbcebd2dbfa5eb63488c7cfb Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sat, 22 Jun 2019 13:35:45 +1000 Subject: [PATCH] test: migrate from tape to tap PR-URL: https://github.com/nodejs/node-gyp/pull/1795 Reviewed-By: Richard Lau --- .gitignore | 1 + .travis.yml | 2 +- package.json | 5 +++-- test/simple-proxy.js | 1 - test/test-addon.js | 4 +--- test/test-configure-python.js | 4 +++- test/test-download.js | 4 +++- test/test-find-accessible-sync.js | 2 +- test/test-find-node-directory.js | 2 +- test/test-find-python.js | 4 +++- test/test-find-visualstudio.js | 2 +- test/test-install.js | 5 +++-- test/test-options.js | 2 +- test/test-process-release.js | 2 +- 14 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 4d6b4d55b7..776066e34d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ gyp/test node_modules test/.node-gyp .ncu +.nyc_output package-lock.json diff --git a/.travis.yml b/.travis.yml index 7607d306fc..f76e561464 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_script: - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - npm install script: - - npm test + - npm run test #- pytest --capture=sys # add other tests here notifications: on_success: change diff --git a/package.json b/package.json index 393e7cac7e..36a00a48ae 100644 --- a/package.json +++ b/package.json @@ -43,10 +43,11 @@ "eslint": "^5.0.1", "nan": "^2.0.0", "require-inject": "~1.3.0", - "tape": "~4.2.0" + "tap": "~14.2.4" }, "scripts": { "lint": "eslint bin lib test", - "test": "npm run lint && tape test/test-*" + "test": "npm run lint && tap test/test-*", + "test-ci": "npm run lint && tap -Rtap test/test-*" } } diff --git a/test/simple-proxy.js b/test/simple-proxy.js index e55330c445..8ac737a652 100644 --- a/test/simple-proxy.js +++ b/test/simple-proxy.js @@ -13,7 +13,6 @@ function handler (req, res) { throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']') var upstreamUrl = upstream + req.url.substring(prefix.length) - console.log(req.url + ' -> ' + upstreamUrl) https.get(upstreamUrl, function (ures) { ures.on('end', function () { if (++calls == 2) diff --git a/test/test-addon.js b/test/test-addon.js index 12687de2ac..5334ab0b18 100644 --- a/test/test-addon.js +++ b/test/test-addon.js @@ -1,6 +1,6 @@ 'use strict' -var test = require('tape') +var test = require('tap').test var path = require('path') var fs = require('graceful-fs') var child_process = require('child_process') @@ -15,7 +15,6 @@ function runHello(hostProcess) { hostProcess = process.execPath } var testCode = "console.log(require('hello_world').hello())" - console.log('running ', hostProcess); return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString() } @@ -25,7 +24,6 @@ function runDuplicateBindings() { "console.log((function(bindings) {" + "return bindings.pointerCheck1(bindings.pointerCheck2());" + "})(require('duplicate_symbols')))" - console.log('running ', hostProcess); return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString() } diff --git a/test/test-configure-python.js b/test/test-configure-python.js index 07cdce2b17..895e488ba8 100644 --- a/test/test-configure-python.js +++ b/test/test-configure-python.js @@ -1,6 +1,6 @@ 'use strict' -var test = require('tape') +var test = require('tap').test var path = require('path') var gyp = require('../lib/node-gyp') var requireInject = require('require-inject') @@ -17,6 +17,8 @@ var EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib') var SEPARATOR = process.platform == 'win32' ? ';' : ':' var SPAWN_RESULT = { on: function () { } } +require('npmlog').level = 'warn' + test('configure PYTHONPATH with no existing env', function (t) { t.plan(1) diff --git a/test/test-download.js b/test/test-download.js index 6e6f64f058..1615b55fb8 100644 --- a/test/test-download.js +++ b/test/test-download.js @@ -1,11 +1,13 @@ 'use strict' +var test = require('tap').test var fs = require('fs') var http = require('http') var https = require('https') -var test = require('tape') var install = require('../lib/install') +require('npmlog').level = 'warn' + test('download over http', function (t) { t.plan(2) diff --git a/test/test-find-accessible-sync.js b/test/test-find-accessible-sync.js index 114403e278..15adec5379 100644 --- a/test/test-find-accessible-sync.js +++ b/test/test-find-accessible-sync.js @@ -1,6 +1,6 @@ 'use strict' -var test = require('tape') +var test = require('tap').test var path = require('path') var requireInject = require('require-inject') var configure = requireInject('../lib/configure', { diff --git a/test/test-find-node-directory.js b/test/test-find-node-directory.js index 46659d0cfe..7cc680d1fa 100644 --- a/test/test-find-node-directory.js +++ b/test/test-find-node-directory.js @@ -1,4 +1,4 @@ -var test = require('tape') +var test = require('tap').test var path = require('path') var findNodeDirectory = require('../lib/find-node-directory') diff --git a/test/test-find-python.js b/test/test-find-python.js index f3c14ce659..fbb35c3d36 100644 --- a/test/test-find-python.js +++ b/test/test-find-python.js @@ -1,10 +1,12 @@ 'use strict' -var test = require('tape') +var test = require('tap').test var configure = require('../lib/configure') var execFile = require('child_process').execFile var PythonFinder = configure.test.PythonFinder +require('npmlog').level = 'warn' + test('find python', function (t) { t.plan(4) diff --git a/test/test-find-visualstudio.js b/test/test-find-visualstudio.js index e2bcc9954f..cf6349c808 100644 --- a/test/test-find-visualstudio.js +++ b/test/test-find-visualstudio.js @@ -1,6 +1,6 @@ 'use strict' -const test = require('tape') +var test = require('tap').test const fs = require('fs') const path = require('path') const findVisualStudio = require('../lib/find-visualstudio') diff --git a/test/test-install.js b/test/test-install.js index f647326a7f..9e44c39bc1 100644 --- a/test/test-install.js +++ b/test/test-install.js @@ -1,8 +1,10 @@ 'use strict' -var test = require('tape') +var test = require('tap').test var install = require('../lib/install').test.install +require('npmlog').level = 'error' // we expect a warning + test('EACCES retry once', function (t) { t.plan(3) @@ -14,7 +16,6 @@ test('EACCES retry once', function (t) { t.ok(true); } - var gyp = {} gyp.devDir = __dirname gyp.opts = {} diff --git a/test/test-options.js b/test/test-options.js index d097f81be6..51d473308c 100644 --- a/test/test-options.js +++ b/test/test-options.js @@ -1,6 +1,6 @@ 'use strict'; -var test = require('tape') +var test = require('tap').test var gyp = require('../lib/node-gyp') test('options in environment', function (t) { diff --git a/test/test-process-release.js b/test/test-process-release.js index 5e4fb81042..83998af041 100644 --- a/test/test-process-release.js +++ b/test/test-process-release.js @@ -1,4 +1,4 @@ -var test = require('tape') +var test = require('tap').test var processRelease = require('../lib/process-release') test('test process release - process.version = 0.8.20', function (t) {