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

I am getting not ok - timeout #3

Closed
pke opened this issue Dec 16, 2015 · 9 comments
Closed

I am getting not ok - timeout #3

pke opened this issue Dec 16, 2015 · 9 comments

Comments

@pke
Copy link

pke commented Dec 16, 2015

using babel-tap src/specs/index.js

index.js

import {test} from 'babel-tap'

test('A passing test', (assert) => {
  assert.pass('This test will pass.')
  assert.end()
})

test('Assertions with tape.', (assert) => {
  const expected = 'something to test'
  const actual = 'sonething to test'

  assert.equal(actual, expected,
    'Given two mismatched values, .equal() should produce a nice bug report')
  assert.end()
})
@jkrems
Copy link
Owner

jkrems commented Dec 16, 2015

Thanks for the feedback! With the latest version of babel-tap (4.0.0) I get the following:

> ./cli.js test.timeout.js 
test.timeout.js ....................................... 1/2 2s
  Assertions with tape.
  not ok Given two mismatched values, .equal() should produce a nice bug report
    +++ found                                                          
    --- wanted                                                         
    -something to test                                                 
    +sonething to test                                                 
    compare: ===
    at:
      file: test.timeout.js
      line: 14
      column: 10
    source: |
      assert.end()
    stack: >
      test.timeout.js:12:10

      Test.test (node_modules/tap/lib/test.js:399:17)

      Object.<anonymous> (test.timeout.js:8:1)

      normalLoader (node_modules/babel-core/lib/api/register/node.js:199:5)

      Object.require.extensions.(anonymous function) [as .js]
      (node_modules/babel-core/lib/api/register/node.js:216:7)

      Object.<anonymous> (node_modules/babel/lib/_babel-node.js:144:25)

      node.js:963:3

total ................................................. 1/2


  1 passing (2s)
  1 failing

I'm running node 4.2 if that makes a difference. Could you create a PR with the failing test to make sure it's reproducible?

@pke
Copy link
Author

pke commented Dec 16, 2015

I am on node 0.12.2 and even with 4.0.0 the output is the same:

babel-tap@4.0.0 node_modules\babel-tap
$ node --version
v0.12.2

$ babel-tap src/specs/index.js
TAP version 13
    # Subtest: src/specs/index.js
    1..0


    not ok - timeout

@jkrems
Copy link
Owner

jkrems commented Mar 9, 2016

Without a test case it's not really possible to reproduce this. Maybe it's a windows issue (seeing a \ separator in your output)..? Happy to look into it if you can create a PR with a failing test. Without it I can't really tell what's going on. :)

@jkrems jkrems closed this as completed Mar 9, 2016
@ffigiel
Copy link

ffigiel commented Mar 16, 2016

I sort of reproduced the problem. It doesn't timeout (Banana PI doesn't count, right?), but it does take a lot of time to finish. Node 4.4.0, deps up-to-date.

Here's a test

$ cat test/dummy.js
import tap from 'babel-tap'

tap.equal(2 + 2, 4, 'Math test')

It takes whooping 6 seconds to run this test:

$ node_modules/.bin/babel-tap test/dummy.js
test/dummy.js ......................................... 1/1 6s
total ................................................. 1/1
  1 passing (6s)
  ok

Now compare this to plain tap tests:

$ cat test/dummy.js
var tap = require('babel-tap');

tap.equal(2 + 2, 4, 'Math test')

It's 20 times faster! 😕

$ node_modules/.bin/tap test/dummy.js
test/dummy.js ......................................... 1/1
total ................................................. 1/1
  1 passing (325.475ms)
  ok

@ffigiel
Copy link

ffigiel commented Mar 16, 2016

Seems like babel-cli is the bottleneck here. How can we speed it up?

$ time node_modules/.bin/babel-node test/dummy.js
TAP version 13
    # Subtest: Dummy test
    ok 1 - Math test
    1..1
ok 1 - Dummy test # time=12.708ms
1..1
# time=37.019ms
real    0m5.519s
user    0m5.104s
sys     0m0.576s

@ffigiel
Copy link

ffigiel commented Mar 17, 2016

Comments in this SO question helped me speed up babael-cli. It's still rather slow, as processing each file takes 1 second.

Is it possible to process all files simultaneously? Currently, if there are 15 test files, it will take ~20s to run the tests

@jkrems
Copy link
Owner

jkrems commented Mar 17, 2016

I'm afraid that's part of how tap works in general (as in: the npm package tap). You could try proposing parallel execution there. babel-tap is just a very thin wrapper around tap itself.

@kapooostin
Copy link

Now tap has an option --no-timeout but babel-tap seems to ignore it.

@jkrems
Copy link
Owner

jkrems commented Mar 14, 2017

@kapooostin Can you find out why? babel-tap just forwards directly to tap itself, it doesn't do any argument parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants