cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Grebnov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-8385) Ensure plugin-test-framework trigger tests only once
Date Fri, 30 Jan 2015 13:56:34 GMT
Sergey Grebnov created CB-8385:
----------------------------------

             Summary: Ensure plugin-test-framework trigger tests only once
                 Key: CB-8385
                 URL: https://issues.apache.org/jira/browse/CB-8385
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin TestFramework
            Reporter: Sergey Grebnov
            Assignee: Sergey Grebnov


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 xhr.onerror
2. Inside exception catch block

{code}
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);
  }
}

{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message