wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
759 stars 45 forks source link

First test pink in each file #130

Closed chrissie1 closed 9 years ago

chrissie1 commented 9 years ago

concerns the Wallaby visual studio extension

using qunit 1.18.0

As you can see in the image bellow the first test in each file test is pink, but the other tests run just fine.

image

This is what I see in the failing tests screen.

image

And this is in the console.

image

I'll try and upload the zipfile with the solution somewhere, hold on.

ArtemGovorov commented 9 years ago

Not sure about the pink test, but from your log it seems like the order of files in your files array in the wallaby config is not correct or some files (such as jquery) are missing. Would be great to have the solution to see what's going on.

chrissie1 commented 9 years ago

I will have to upload it later today since at work everything I can think of to upload it is blocked. Even making a project and adding it to github.

The second test, which uses the same file runs just fine.

Here is the conf file

{
    "files": [
     "Scripts/*.js"
    ],
    "tests": [
      "Tests/*Tests.js"
    ],
    "testFramework": "qunit@1.18.0"
}

But it should all be clearer in a few hours when I can upload the solution.

ArtemGovorov commented 9 years ago

I can see at least one potential issue with your config file: Scripts/*.js will make wallaby load the scripts from the folder in alphabetical order. It's not working because the scripts depend on each other, so they have to be listed in the order like you are loading them on your test page or on your production pages.

Having Tests/*Tests.js is fine, because the order is not important (if your tests do not depend on each other).

You may have a look here for more details.

chrissie1 commented 9 years ago

And I guess it works for the second test because all the dependencies are already loaded for that one?

Ok, I will try that on thursday when I'm back at work.

Anyway here is the test project https://github.com/chrissie1/wallabytest

chrissie1 commented 9 years ago

You can close this issue and thanks very much for helping.

ArtemGovorov commented 9 years ago

Yep, that's the case.

Thanks for the test project! I have managed to make it work with the config like this (that pretty much reflects your test page scripts order):

{
    "files": [
      "Css/*.css",
      { "pattern": "Scripts/jquery-2.1.3.js", "instrument": false },
      { "pattern": "Scripts/jsondiffpatch.min.js", "instrument": false },
      { "pattern": "Scripts/jsondiffpatch-full.min.js", "instrument": false },
      { "pattern": "Scripts/diff_match_patch_uncompressed.js", "instrument": false },
      { "pattern": "Scripts/bootstrap-maxlength.min.js", "instrument": false },
      "Scripts/truncate.js",
      "Scripts/search.js"
    ],
    "tests": [
      "Tests/*Tests.js"
    ],
    "testFramework": "qunit@1.18.0"
}

If you'd like to make it less verbose, you may use JavaScript fro the config file (as opposed to JSON) and set wallaby.defaults.files.instrument = false; like in the sample code here.