Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browserified createStream breaks wait for plans #323

Open
mstdokumaci opened this issue Sep 26, 2016 · 0 comments
Open

Browserified createStream breaks wait for plans #323

mstdokumaci opened this issue Sep 26, 2016 · 0 comments

Comments

@mstdokumaci
Copy link

Test code:

'use strict'

const test = require('tape')

test('test #1', t => {
  t.plan(2)
  t.ok(true, 'get #1 first result')
  setTimeout(() => {
    t.ok(true, 'get #1 second result')
  }, 500)
})

test('test #2 - should fail on plan', t => {
  t.plan(3)
  t.ok(true, 'get #2 first result')
  setTimeout(() => {
    t.ok(true, 'get #2 second result')
  }, 500)
})

test.createStream()
  .on('data', line => {
    console.log(line.trim())
  })
  .on('close', () => {
    const {count, fail, pass} = test.getHarness()._results
    console.log({count, fail, pass})
  })

Node output:

TAP version 13
# test #1
TAP version 13
# test #1
ok 1 get #1 first result
ok 1 get #1 first result
# test #2 - should fail on plan
# test #2 - should fail on plan
ok 2 get #2 first result
ok 2 get #2 first result
ok 3 get #1 second result
ok 3 get #1 second result
ok 4 get #2 second result
ok 4 get #2 second result
not ok 5 plan != count
  ---
    operator: fail
    expected: 3
    actual:   2
  ...
not ok 5 plan != count
  ---
    operator: fail
    expected: 3
    actual:   2
  ...

1..5
1..5
# tests 5
# tests 5
# pass  4
# pass  4
# fail  1
# fail  1

{ count: 5, fail: 1, pass: 4 }

Browserified console output:

TAP version 13
# test #1
TAP version 13
# test #1
ok 1 get #1 first result
ok 1 get #1 first result
# test #2 - should fail on plan
# test #2 - should fail on plan
ok 2 get #2 first result
ok 2 get #2 first result
ok 3 get #1 second result
ok 3 get #1 second result
ok 4 get #2 second result
ok 4 get #2 second result

1..4
1..4
# tests 4
# tests 4
# pass  4
# pass  4

# ok
# ok

Object { count: 4, fail: 0, pass: 4 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants