badeball / karma-jsdom-launcher

A Karma plugin. Launcher for jsdom.
MIT License
37 stars 16 forks source link

no message in 10000 ms. #6

Closed mattdell closed 5 years ago

mattdell commented 8 years ago

I've got jsdom up and running so that when I run mocha my tests pass fine. I've now converted my karma config to use the jsdom runner instead of phantomjs. For some reason though the tests don't seem to execute.

This is what I get after a 10 second timeout:

mdell@UK134489 ~/W/R/a/web> npm test

> web-aztec@3.0.0 test /Users/mdell/Work/Repos/aztec/web
> karma start test-setup/karma.conf.js

START:
20 06 2016 15:55:05.826:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
20 06 2016 15:55:05.838:INFO [launcher]: Starting browser jsdom
20 06 2016 15:55:06.423:INFO [Node.js (darwin; U; rv:v5.1.0)]: Connected on socket /#2fxQgSEmyYEuu2aOAAAA with id 39523001
20 06 2016 15:55:16.428:WARN [Node.js (darwin; U; rv:v5.1.0)]: Disconnected (1 times), because no message in 10000 ms.

Finished in 10.005 secs / 0 secs

npm ERR! Test failed.  See above for more details.
mdell@UK134489 ~/W/R/a/web> 

I don't see a lot of documentation here so I'm a bit lost. Have I forgotten a step?

mattdell commented 8 years ago

I've figured out one piece of the puzzle and discovered another issue. It seems my tests timeout because they don't run. If I go to the URL where karma server is running then the tests execute.

I've attached what is probably the dullest video ever, but if you start at 0:55 then you'll see some action. After that it does absolutely nothing until it hits a 100 second timeout that I put in place (rather than the default 10).

https://www.dropbox.com/s/g8d83mbl4qrhoaz/jsdom-karma.mov?dl=0

I now seem to be in a similar place to Issue #4.

badeball commented 8 years ago

Hi, @mattdell

I can't seem to replicate the issue you're describing. Can you provide a minimal working example?

bencripps commented 8 years ago

+1, I also have this exact issue

andrepcg commented 7 years ago

+1 I also have this issue. Node 7.4.0 does not solve this issue

racoleman commented 7 years ago

I doubt everyone experiencing this issue has the same root cause, but for me it is caused by a polyfill for setImmediate that was introduced in timers-browserify 2.0, which is a dependency of node-libs-browser 2.0, which is a dependency of webpack as of 2.1.0-beta.28. If I use beta.27, the problem goes away. Shrinkwrapping timers-browserify to 1.4.2 (before the polyfill was introduced) also resolves the issue.

Here is the commit in question: https://github.com/jryans/timers-browserify/commit/48f38e6c7ecb22fb51cc0870c1a2e8a2e16ba700

lukastaegert commented 7 years ago

We are having a somewhat similar issue. In our setup, we are using Webpack@2.2.1 together with the karma-jsdom-launcher and the karma-mocha-reporter. As it turns out, reporter output seems to be aggregated and displayed only once every 50 tests. If I put a console.log into each test, those logs appear at about the right time. The problem ist that for long running tests, there can be no output for quite some time which is interpreted by (I assume?) mocha as a test timeout. Our current hacky solution is to add a global afterEach which logs a simple number to tell mocha we are still alive. A somewhat more substantial solution would be preferred, however. @dn-rob I did not get this to work, unfortunately, maybe it is a different issue?

jannhama commented 7 years ago

Seems that NodeJS version matters. I had 7.4.0 and tests failed but rolling back to latest LTS version (6.10.2) tests started to run.

badeball commented 5 years ago

Closing due to inactivity. Anyone who continues to experience the issue are encouraged to say so, but please construct a minimal example that consistently produce the error (containing a package-lock and the used node version).