Skip to content

Commit

Permalink
Make various random tests pass when TAP_BUFFER=1
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jan 8, 2017
1 parent a3bb777 commit 750b63d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions test/segv.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test('setup', function (t) {
})

test('segv', function (t) {
var tt = new Test({ bail: false })
var tt = new Test({ bail: false, buffered: false })
tt.spawn('./segv')
var res = ''
tt.on('data', function (c) {
Expand Down Expand Up @@ -81,7 +81,6 @@ test('segv', function (t) {
})

test('cleanup', function (t) {
return t.end()
t.plan(2)
fs.unlink('segv', function (er) {
t.ifError(er, 'clean up segv')
Expand Down
26 changes: 13 additions & 13 deletions test/test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,24 @@ test('testing the test object', function (t) {

test('plan stuff', function (t) {
t.throws(function () {
var tt = new Test()
var tt = new Test({ buffered: false })
tt.plan(1)
tt.plan(1)
}, new Error('Cannot set plan more than once'))
t.throws(function () {
var tt = new Test()
var tt = new Test({ buffered: false })
tt.plan('foo')
}, new TypeError('plan must be a number'))
t.throws(function () {
var tt = new Test()
var tt = new Test({ buffered: false })
tt.plan(-1)
}, new TypeError('plan must be a number'))

t.end()
})

test('do nothing after bailout', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -117,7 +117,7 @@ test('do nothing after bailout', function (t) {
})

test('subtest without arguments', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -131,7 +131,7 @@ test('subtest without arguments', function (t) {
})

test('subtest with only a name', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -145,7 +145,7 @@ test('subtest with only a name', function (t) {
})

test('subtest with only options', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -159,7 +159,7 @@ test('subtest with only options', function (t) {
})

test('subtest with only a function', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -173,7 +173,7 @@ test('subtest with only a function', function (t) {
})

test('subtest with name and options', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -187,7 +187,7 @@ test('subtest with name and options', function (t) {
})

test('subtest with name and function', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -201,7 +201,7 @@ test('subtest with name and function', function (t) {
})

test('subtest with options and function', function (t) {
var tt = new Test()
var tt = new Test({ buffered: false })
var out = ''
tt.on('data', function (c) {
out += c
Expand All @@ -216,7 +216,7 @@ test('subtest with options and function', function (t) {

test('invalid test arguments', function (t) {
t.throws(function () {
var tt = new Test()
var tt = new Test({ buffered: false })
tt.test('name', { skip: false }, 'not a function')
}, new TypeError('test() callback must be function if provided'))

Expand All @@ -228,7 +228,7 @@ test('throws type', function (t) {
throw new TypeError('some type error');
}, TypeError, 'should throw a TypeError');

var tt = new Test()
var tt = new Test({ buffered: false })
t.notOk(tt.throws(function () {
throw new RangeError('x')
}, TypeError))
Expand Down
4 changes: 2 additions & 2 deletions test/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tap.test('t.setTimeout()', function (t) {
tt.setTimeout('not a number')
}, {}, { message: 'setTimeout: number > 0 required' })

var tt = new Test({ timeout: 1000, bail: false })
var tt = new Test({ timeout: 1000, bail: false, buffered: false })
tt.setTimeout(2000)
tt.setTimeout(Infinity)
t.notOk(tt._timeout)
Expand All @@ -58,7 +58,7 @@ tap.test('t.setTimeout()', function (t) {
' # failed 1 of 2 tests\n' +
'not ok 1 - child test # time=')

tt = new Test({ name: 'some name', bail: false })
tt = new Test({ name: 'some name', bail: false, buffered: false })
tt.test('child test', { bail: false }, function (tt) {
tt.pass('this is fine')
})
Expand Down

0 comments on commit 750b63d

Please sign in to comment.