Skip to content

Commit 674994e

Browse files
committed
Reorganizes structure, adds test.count.
1 parent 26e0301 commit 674994e

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "tinytap",
3-
"version": "0.1.1",
4-
"description": "Tiny tap parser and tools.",
5-
"main": "./lib/tester/tester.js",
3+
"version": "0.2.0",
4+
"description": "Tiny TAP tester and test runner.",
5+
"main": "./src/tester.js",
66
"bin": {
7-
"tinytap": "./lib/testrunner/runner.js"
7+
"tinytap": "./src/runner.js"
88
},
99
"dependencies": {
1010
"glob": "^4.0.0",
1111
"shell-quote": "^1.4.1"
1212
},
1313
"scripts": {
14-
"test": "echo \"Error: no test specified\" && exit 1"
14+
"test": "cd test; ./test.sh"
1515
},
1616
"author": "",
1717
"license": "MIT",
File renamed without changes.

lib/testrunner/runner.js renamed to src/runner.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ var spawn = require('child_process').spawn;
44
var parse = require('shell-quote').parse;
55
var quote = require('shell-quote').quote;
66
var stream = require('stream');
7-
var tinytap = require('./parser.js');
87
var glob = require('glob');
98

9+
var tinytap = require('../src/parser');
10+
1011
var args = process.argv.slice(2);
1112
var list = [[null]];
1213

lib/tester/tester.js renamed to src/tester.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// tiny node-tap lookalike.
21
module.exports = test
32

43
var tests = module.exports.tests = [];
@@ -17,6 +16,10 @@ function test(name, fn) {
1716
var assert = require('assert');
1817
Error.captureStackTrace = function(){};
1918

19+
test.count = function (n) {
20+
console.log('1..' + Number(n));
21+
}
22+
2023
var t = Object.keys(assert).map(function (k) {
2124
if (typeof assert[k] !== 'function') return;
2225
return [k, function () {
@@ -77,16 +80,14 @@ t.test = function(name, fn) {
7780
children.push([name, fn])
7881
}
7982

80-
function run() {
83+
function run () {
8184
if (children.length) {
8285
tests.unshift.apply(tests, children)
8386
children.length = 0
8487
}
8588

8689
var next = tests.shift();
8790
if (!next) {
88-
console.log('0..', id)
89-
console.log('')
9091
console.log('# pass', pass, pass + fail)
9192
console.log('# fail', fail, pass + fail)
9293
process.exit(fail)

test/test.sh

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cat colony.tap | node index.js - > out.tap
2-
cat out.tap | node index.js - > out2.tap
1+
cat colony.tap | node ../src/runner.js - > out.tap
2+
cat out.tap | node ../src/runner.js - > out2.tap
33
diff out.tap out2.tap
44
rm out.tap
55
rm out2.tap

0 commit comments

Comments
 (0)