Skip to content

Commit

Permalink
test: migrate from tape to tap
Browse files Browse the repository at this point in the history
PR-URL: #1795
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information
rvagg committed Jun 25, 2019
1 parent 03683f0 commit a52c6eb
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ gyp/test
node_modules
test/.node-gyp
.ncu
.nyc_output
package-lock.json
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-*"
}
}
1 change: 0 additions & 1 deletion test/simple-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions test/test-addon.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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()
}

Expand All @@ -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()
}

Expand Down
4 changes: 3 additions & 1 deletion test/test-configure-python.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion test/test-download.js
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/test-find-accessible-sync.js
Original file line number Diff line number Diff line change
@@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion test/test-find-node-directory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var test = require('tape')
var test = require('tap').test
var path = require('path')
var findNodeDirectory = require('../lib/find-node-directory')

Expand Down
4 changes: 3 additions & 1 deletion test/test-find-python.js
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/test-find-visualstudio.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
5 changes: 3 additions & 2 deletions test/test-install.js
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -14,7 +16,6 @@ test('EACCES retry once', function (t) {
t.ok(true);
}


var gyp = {}
gyp.devDir = __dirname
gyp.opts = {}
Expand Down
2 changes: 1 addition & 1 deletion test/test-options.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion test/test-process-release.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit a52c6eb

Please sign in to comment.