diff --git a/package.json b/package.json index dbe4f140..af9b5b23 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ }, "devDependencies": { "du": "~0.1.0", + "faucet": "0.0.1", "mkfiletree": "~0.0.1", "monotonic-timestamp": "~0.0.8", "node-gyp": "~1.0.1", @@ -43,10 +44,10 @@ "readfiletree": "~0.0.1", "rimraf": "~2.2.8", "slump": "~2.0.0", - "tap": "~0.4.12" + "tape": "~4.0.0" }, "scripts": { - "test": "tap test/*-test.js --stderr" + "test": "tape test/*-test.js | faucet" }, "license": "MIT", "gypfile": true diff --git a/test/approximate-size-test.js b/test/approximate-size-test.js index 788d10e1..31038a48 100644 --- a/test/approximate-size-test.js +++ b/test/approximate-size-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/approximate-size-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/batch-test.js b/test/batch-test.js index 4040eeac..c93e6eff 100644 --- a/test/batch-test.js +++ b/test/batch-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/batch-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/chained-batch-test.js b/test/chained-batch-test.js index 562f8685..cc20f9e4 100644 --- a/test/chained-batch-test.js +++ b/test/chained-batch-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/chained-batch-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/cleanup-hanging-iterators-test.js b/test/cleanup-hanging-iterators-test.js index f811b7db..3ed394e6 100644 --- a/test/cleanup-hanging-iterators-test.js +++ b/test/cleanup-hanging-iterators-test.js @@ -1,7 +1,7 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') - , makeTest = require('./make-test') + , makeTest = require('./make') makeTest('test ended iterator', function (db, t, done) { // standard iterator with an end() properly called, easy diff --git a/test/close-test.js b/test/close-test.js index 3b9f9e79..ae5d3bf8 100644 --- a/test/close-test.js +++ b/test/close-test.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/close-test') @@ -19,5 +19,4 @@ module.exports.all = function (leveldown) { module.exports.tearDown() } -if (require.main === module) - module.exports.all(leveldown) \ No newline at end of file +module.exports.all(leveldown) diff --git a/test/del-test.js b/test/del-test.js index f1b12c9b..b21712be 100644 --- a/test/del-test.js +++ b/test/del-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/del-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/destroy-test.js b/test/destroy-test.js index aa970534..d1be840e 100644 --- a/test/destroy-test.js +++ b/test/destroy-test.js @@ -1,11 +1,11 @@ -const test = require('tap').test +const test = require('tape') , fs = require('fs') , path = require('path') , mkfiletree = require('mkfiletree') , readfiletree = require('readfiletree') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') - , makeTest = require('./make-test') + , makeTest = require('./make') test('test argument-less destroy() throws', function (t) { t.throws( diff --git a/test/get-test.js b/test/get-test.js index 5423ea1b..52270ad3 100644 --- a/test/get-test.js +++ b/test/get-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/get-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/getproperty-test.js b/test/getproperty-test.js index db48946f..46bce118 100644 --- a/test/getproperty-test.js +++ b/test/getproperty-test.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') @@ -54,4 +54,4 @@ test('test invalid getProperty("leveldb.sstables")', function (t) { test('tearDown', function (t) { db.close(testCommon.tearDown.bind(null, t)) -}) \ No newline at end of file +}) diff --git a/test/iterator-recursion-test.js b/test/iterator-recursion-test.js index ff2a780b..db18dab3 100644 --- a/test/iterator-recursion-test.js +++ b/test/iterator-recursion-test.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , child_process = require('child_process') @@ -32,20 +32,19 @@ test('try to create an iterator with a blown stack', function (t) { // Reducing the stack size down from the default 984 for the child node // process makes it easier to trigger the bug condition. But making it too low // causes the child process to die for other reasons. - var opts = { execArgv: ["--stack-size=128"] } - , child = child_process.fork(__dirname + '/stack-blower.js', ["run"], opts) + var opts = { execArgv: [ '--stack-size=128' ] } + , child = child_process.fork(__dirname + '/stack-blower.js', [ 'run' ], opts) + + t.plan(2) child.on('message', function (m) { - t.ok(true, m) - child.disconnect() - - t.end() - }) - .on('exit', function (code, sig) { - t.ok(false, "Child exited with code=" + code + " sig=" + sig) + t.ok(true, m) + child.disconnect() + }) - t.end() - }) + child.on('exit', function (code, sig) { + t.equal(code, 0, 'child exited normally') + }) }) test('iterate over a large iterator with a large watermark', function (t) { @@ -69,4 +68,4 @@ test('iterate over a large iterator with a large watermark', function (t) { test('tearDown', function (t) { db.close(testCommon.tearDown.bind(null, t)) -}) \ No newline at end of file +}) diff --git a/test/iterator-test.js b/test/iterator-test.js index 18073f61..1c179a9b 100644 --- a/test/iterator-test.js +++ b/test/iterator-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/iterator-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/leveldown-test.js b/test/leveldown-test.js index d65e0783..11db1c38 100644 --- a/test/leveldown-test.js +++ b/test/leveldown-test.js @@ -1,6 +1,5 @@ -const test = require('tap').test +const test = require('tape') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/leveldown-test') -if (require.main === module) - abstract.args(leveldown, test) \ No newline at end of file +abstract.args(leveldown, test) diff --git a/test/make-test.js b/test/make.js similarity index 94% rename from test/make-test.js rename to test/make.js index 167027d2..aeccf3b4 100644 --- a/test/make-test.js +++ b/test/make.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , cleanup = testCommon.cleanup , location = testCommon.location @@ -35,4 +35,4 @@ function makeTest (name, testFn) { }) } -module.exports = makeTest \ No newline at end of file +module.exports = makeTest diff --git a/test/open-test.js b/test/open-test.js index 4d849962..0da638a3 100644 --- a/test/open-test.js +++ b/test/open-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/open-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/port-libuv-fix-test.js b/test/port-libuv-fix-test.js index 089f1e66..300baa71 100644 --- a/test/port-libuv-fix-test.js +++ b/test/port-libuv-fix-test.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , path = require('path') , fs = require('fs') diff --git a/test/put-get-del-test.js b/test/put-get-del-test.js index 631d886c..0f688585 100644 --- a/test/put-get-del-test.js +++ b/test/put-get-del-test.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , fs = require('fs') @@ -6,5 +6,4 @@ const test = require('tap').test , testBuffer = fs.readFileSync(path.join(__dirname, 'data/testdata.bin')) , abstract = require('abstract-leveldown/abstract/put-get-del-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon, testBuffer) +abstract.all(leveldown, test, testCommon, testBuffer) diff --git a/test/put-test.js b/test/put-test.js index f24997f9..e437f5ee 100644 --- a/test/put-test.js +++ b/test/put-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/put-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) \ No newline at end of file +abstract.all(leveldown, test, testCommon) diff --git a/test/ranges-test.js b/test/ranges-test.js index 59742d4e..7f16a2d0 100644 --- a/test/ranges-test.js +++ b/test/ranges-test.js @@ -1,7 +1,6 @@ -const test = require('tap').test +const test = require('tape') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') , abstract = require('abstract-leveldown/abstract/ranges-test') -if (require.main === module) - abstract.all(leveldown, test, testCommon) +abstract.all(leveldown, test, testCommon) diff --git a/test/repair-test.js b/test/repair-test.js index 225a3ac3..17f35148 100644 --- a/test/repair-test.js +++ b/test/repair-test.js @@ -1,11 +1,11 @@ -const test = require('tap').test +const test = require('tape') , fs = require('fs') , path = require('path') , mkfiletree = require('mkfiletree') , readfiletree = require('readfiletree') , testCommon = require('abstract-leveldown/testCommon') , leveldown = require('../') - , makeTest = require('./make-test') + , makeTest = require('./make') test('test argument-less repair() throws', function (t) { t.throws( @@ -27,7 +27,7 @@ test('test callback-less, 1-arg, repair() throws', function (t) { test('test repair non-existant directory returns error', function (t) { leveldown.repair('/1/2/3/4', function (err) { - t.like(/no such/i, err, 'error on callback') + t.ok(/no such/i.test(err), 'error on callback') t.end() }) })