JamesMGreene / qunit-composite

A QUnit plugin for running multiple test files.
Other
34 stars 14 forks source link

Possible issue with QUnit 1.21.0 #18

Closed djensenIncomm closed 8 years ago

djensenIncomm commented 8 years ago

Hi, qunit-composite isn't working completely on QUnit 1.21.0. It does, however, work on version 1.19.0.

The problem I'm having is the test results are only showing the first suite listed. The following screenshot is using qunit-1.21.0: qunit-1 21 0

Now look what happens when I use qunit-1.19.0: qunit-1 19 0

Notice how version 1.19.0 shows all three of my test suites, whereas version 1.21.0 only shows the first in some werid split-screen fashion.

Any ideas?

Thanks,

David

leobalter commented 8 years ago

It looks like your Configuration: Account test is still running and haven't finished yet, without a timeout failure.

This might be a regression on QUnit. Do you mind to check an isolated run on that particular test file, without the composite?

djensenIncomm commented 8 years ago

If I run the test without composite, using qunit-1.21.0, it works as shown below: qunit-1 21 0-withoutcomposite

The above screenshot is from a file called "qunit-account.html" and looks like:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>QUnit Tests</title>
  <link rel="stylesheet" href="../webapp/qunit/qunit-1.21.0.css">
</head>
<body>
    <div id="qunit"></div>
    <div id="qunit-fixture"></div>
    <script src="../webapp/qunit/qunit-1.21.0.js"></script>
    <script src="../../main/webapp/js/angular/angular-1.4.9.min.js"></script>
    <script src="../../main/webapp/js/angular/angular-route-1.4.9.min.js"></script>
    <script src="../../main/webapp/configuration/account/js/angular/app.js"></script>
    <script src="../../main/webapp/configuration/account/js/angular/controllers.js"></script>
    <script src="../webapp/configuration/account/tests.js"></script>
</body>
</html>

The HTML for the "composite" version is:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>QUnit Tests</title>
  <link rel="stylesheet" href="../webapp/qunit/qunit-1.19.0.css"><!-- qunit-composite seems to only work with 1.19.0 and below which is why we haven't upgraded. -->
  <link rel="stylesheet" href="../webapp/qunit/qunit-composite.css"><!-- Third-party tool used to run multiple test suites (which QUnit apparently can't do). -->
</head>
<body>
    <script src="../webapp/qunit/qunit-1.19.0.js"></script><!-- qunit-composite seems to only work with 1.19.0 and below which is why we haven't upgraded. -->
    <script src="../webapp/qunit/qunit-composite.js"></script><!-- Third-party tool used to run multiple test suites (which QUnit apparently can't do). -->

    <div id="qunit"></div>
    <div id="qunit-fixture"></div>

    <script type="text/javascript">
        QUnit.testSuites("Configuration", [
                {name: "Account", path: "qunit-account.html"}
        ]);
        QUnit.testSuites("Card Properties", [
                {name: "DDP", path: "qunit-ddp.html"}
        ]);
        QUnit.testSuites("ICT", [
                {name: "ICT", path: "qunit-ict.html"}
        ]);
    </script>
</body>
</html>

Do you see anything wrong with my code?

Thanks,

David

leobalter commented 8 years ago

I'll run some tests locally trying to reproduce this issue. So far the only thing I can tell (and probably not what caused the bug) is that your html examples shows the tests html using 1.21 and the composite html using 1.19.

JamesMGreene commented 8 years ago

For me, the basic test included in this repo works for QUnit 1.18.x and 1.19.x but is broken in QUnit v1.20.x, v1.21.x, v1.22.x, and v1.23.x (the latest). :cry:

platinumazure commented 8 years ago

Seems the regression was introduced in QUnit commit ea3e350.

The upstream change was done to forbid QUnit.start from accepting non-numeric arguments. We use QUnit.done to call QUnit.start here. Unfortunately, QUnit.done is invoked with a details object which is non-numeric. The solution is to pass an anonymous callback instead to avoid the argument getting forwarded along to QUnit.start.

I'm working on a PR now.

JamesMGreene commented 8 years ago

Thanks for the investigation and PR, @platinumazure!

The fix has been published to NPM in v1.2.2.