After retargeting to Windows 8.1 the tests doesn't run!

Feb 4, 2014 at 5:46 PM
I've managed to download and execute this sample, including the tests on Windows 8.1 with Visual Studio 2013. BUT, when I choose to retarget the Projects to Windows 8.1 in Visual Studio 2013, the tests fail to run.

It seems the suite of tests isn't properly created somehow. I've tried to debug and find the proper line where this fails but unfortunately not. The only thing I manage to identify is that when the specRunner.js line 172 is being executed (which seems to add the test specific tag to the UI, the Windows 8 version successfully populates the mocha.suites with a suite of tests, but with the Windows 8.1 version this never happens. The line is executed but mocha.suites collection is not updated.

If anyone with better understanding of the mocha.js framework could help it would be greatly appreciated!

Johan Lindfors
Coordinator
Feb 4, 2014 at 5:52 PM
Hi Johan,

The approach that we used for unit tests turned out to be incompatible with 8.1.
We haven't had an opportunity to revisit the code, however InfernoRedArt has posted a pull request that addresses the problem:
https://hilojs.codeplex.com/SourceControl/network/forks/InfernoRedArt/Windows81/contribution/5372
Mar 11, 2014 at 4:37 PM
I have fixed this by the way the script tags are added.
buildScriptTags: function (fileList) {
      var appPath = this.appFolder.path.toLowerCase();

      var specList = fileList.map(function (file) {
        var filePath = file.path.toLowerCase().replace(appPath, "");
        var script = document.createElement("script");
        script.language = "javascript";
        // This doesn't seem to do anything in DOCMODE 11
        script.async = false;
        // In DOCMODE 11 IE moved to the standards based script loading behavior of
        // having out-of-line script elements which are dynamically added to the DOM 
        // asynchronously load.
        // http://msdn.microsoft.com/en-us/library/windows/apps/dn263112.aspx
        // So we wait for the script to be loaded here using a Promise
        var promise = new WinJS.Promise(function (c, e) {
          script.onload = function () {
            c(script);
          };
          script.onerror = function () {
            e(new Error("Could not load " + script.src));
          }
          script.setAttribute("src", filePath);
        });
        // This is done async since 8.1
        head.appendChild(script);
        return promise;
      });

      return WinJS.Promise.join(specList);
    },