JsChilicat
JsChilicat copied to clipboard
Deadlock with chilicat browser emulation with jQuery Mobile
Trying to get code coverage on a jQuery Mobile project, jschilicat blocks indefinitely if jQM is included in the list of libs. Blocking occurs during the parser eval of "window.location = rhino_index.html;" (which is just the very unfancy plain page in the jschilicat.jar). The page loads from the embedded server with a 200 OK, but ends up stuck somewhere inside the rhino-compiled jQM.
Disabling all of the jQM config options doesn't help at all. Only workaround I've found so far is to mock/stub the jQM methods and events I need to test.
Have you tried to execute your tests with htmlunit?
java -jar jschilicat.jar -htmlunit
htmlunit doesn't support code coverage but it would help to figure out where the problem is.
I'll go ahead and give this a try, and investigate further. UPDATE Simple "hello world" tests ran OK with jQuery + jQuery Mobile loaded into htmlunit (once I'd put the tests in a qunit module, seems -htmlunit needs at least one qunit module to complete successfully), but adding the module() call didn't change anything running under -chilicat. Still looking into it.
Looks like it's an issue with env.js and timers. https://github.com/envjs/env-js/issues/15 seems to be the problem, or something related to it. The plain page load in Rhino doesn't stop any running timers, and if a timer is running, env.js never completes and Rhino never returns. There doesn't seem to be much maintenance going on the env-js main branch, but there are quite a few commits on forks that might help, so I'll look around for a way to patch the env-js included in chilicat.
I'm sure there are plenty of other frameworks that start timers... so a workaround would be good.