Compatibility with jQuery Mobile #204

sdesalas opened this Issue Mar 20, 2012 · 4 comments


None yet

4 participants


I'm just in the middle of implementing some Jasmine tests for a jQuery mobile application I'm working on, I've run into an error that I managed to track down to adding the jQuery mobile library, the error is as follows:

Jasmine.js:1769 TypeError: Cannot read property 'abort' of undefined.

As soon as I remove the jQM dependency, the error goes away.

This is my code:

<!DOCTYPE html>
<link type="text/css" rel="stylesheet" href="libs/jasmine.css" media="screen">
<link type="text/css" rel="stylesheet" href="../../Common/libs/" />
<script type="text/javascript" src="libs/jasmine.js"></script>
<script type="text/javascript" src="libs/jasmine-html.js"></script>
<script type="text/javascript" src="../../Common/libs/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../../Common/libs/"></script>
<script type="text/javascript" src="../../Common/libs/myLib.js"></script>
<script type="text/javascript">
describe("Suite 1", function() {
it("Should be that 1 equals 0", function() {
<script type="text/javascript">
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());

I'd prefer to use Jasmine for this application instead of qUnit as I think its more flexible and easier to implement in CI and explain to the BA's and PM's.. however after tinkering with this problem for a couple of hours and some futile searches on google I still havent been able to solve it so I'm starting to consider moving on.

Here is the stack-overflow URL in case there is a workaround come up from the discussion or whoever solves it wants to claim brownie points there:

Thanks and Regards.


Can you paste in the context around line 1769 of the jasmine.js that you're using? It doesn't appear to be HEAD. If I had to guess I'd say it's this line:

if (self.blocks[self.index].abort) {
self.abort = true;

which suggests some of your blocks might be empty?

I also notice you're jasmine.getEnv().execute()-ing without waiting for the DOM page ready to fire. Try wrapping your execute in $(function() { }) to wait until the page ready fires and see if that helps (refer to the example for more info).


Hi ragaskar,

Thanks for your prompt response and your help. Yep thats correct the line causing the error is in 'jasmine.Queue.prototype.next_' code below:

if (self.blocks[self.index].abort) {
self.abort = true;

I looked at the execution scope and 'self' was of type jasmine.Queue, 'self.blocks' was an Array[1] and 'self.index' was 1 too, thus causing the error.

I tried wrapping the .execute() inside a $(document).ready(function() { ... }); to await for all scripts to load and execute and it still fires off the same error.

For my first test there was only a single test inside a test block as follows so I'm unsure what is causing it:

describe("Suite 1", function() {
it("Should be that 1 equals 0", function() {

My only guess is that this is somehow related to the extensive DOM manipulation carried out inside jQueryMobile, which basically walks through the HTML page and recreates the DOM and applies styling according to special formatting rules based on data-role="X" attributes. Im not sure wether this is helpful but you can read more on:

Try right-click and 'Inspect Element' on one of the formatted lists there and you'll see what I mean.


We've changed how the queuing of functions works pretty drastically on master.

Can you take a look and see if the problem persists?

Jasmine member

Closing for now. Please let us know/reopen this if this is still an issue for you.

@slackersoft slackersoft closed this Oct 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment