QUnit is only running the first test
Asked Answered
T

2

28

I can't get QUnit to run any test after the first. To be sure I wasn't doing something weird, I pared down the code to be as basic as possible.

test("A", function () {
    ok(true, "Test A");
});
test("B", function () {
    ok(true, "Test B");
});

Test A is the only one that runs. No errors thrown or anything else.

My HTML file looks like this.

<!DOCTYPE html>
<html>
<head>
   <title>Test title</title>
   <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css">
</head>
<body>
   <div id="qunit"></div>
   <script src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
   <script src="tests.js" type="text/javascript"></script>
</body>
</html>
Tsarism answered 6/12, 2012 at 21:16 Comment(3)
I copy pasted everything into jsfiddle and it worked. Could this have something to do with running it locally?Tsarism
Tested running through a local Apache server rather than file:// and found that it worked. Can anyone explain what's going on here?Tsarism
If you're having this problem, tell the QUnit people that the UI is dumb! github.com/jquery/qunit/issues/528Tsarism
T
62

Found the problem. It was this!

qunit.html?testNumber=1

I guess at some point I hit rerun and it ignored the other tests!

This other question deserves credit for pointing me in the right direction. QUnit Won't Run Tests

Tsarism answered 6/12, 2012 at 22:1 Comment(3)
where is qunit.html?testNumber=1? in which file. I run same problem.Italicize
@Italicize In the URL. Just got caught with that. Thanks +1Lactation
Thank dude, I did the exact same thing by accident, could not figure out one only one test was running, event though multiple ones were specified.Austro
C
0

very similar to Mims H. Wright's answer.

I also hit "rerun" on a failing test, and it appended the testId to my url, which I didnt notice.

tests.html?testId=fb134038
Cacodemon answered 25/7, 2015 at 18:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.