Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-8385

Ensure plugin-test-framework runs tests only once

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I see this on Windows. This is happening when test-framework checks whether Medic config exists and calls callback twice when there is no config available (default case when you use test framework locally):
      1. Inside onload
      2. Inside exception catch block

      exports.load = function (callback) {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", "../medic.json", true);
        xhr.onload = function() {
          if (xhr.readyState == 4 && xhr.status == 200) {
            var cfg = JSON.parse(xhr.responseText);
            exports.logurl = cfg.logurl;
            exports.enabled = true;
            console.log('Loaded Medic Config: logurl=' + exports.logurl);
          }
          callback();
        }
        xhr.onerror = function() {
         callback();
        }
      
        try {
          xhr.send(null);
        }
        catch(ex) {
          // some platforms throw on a file not found
          console.log('Did not find medic config file');
          setTimeout(function(){
              callback();
          },0);
        }
      }
      
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            sgrebnov Sergey Grebnov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment