mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-12 03:58:40 +01:00
Fixed timeouts
This commit is contained in:
parent
0ffd48cef5
commit
65eb4701ca
5 changed files with 12 additions and 17 deletions
|
|
@ -84,7 +84,7 @@ module.exports = function(grunt){
|
|||
});
|
||||
});
|
||||
grunt.registerTask("test", "Run all tests using mocha", function(){
|
||||
var files = grunt.file.expand(["./tests/test-*.js", "./htdocs/**/test-*.js"]);
|
||||
var files = grunt.file.expand(["./tests/test-*.js", "./htdocs/**/test-*.js", "./htdocs/**/*.test.js"]);
|
||||
console.log("Will run tests: "+files);
|
||||
var done = this.async();
|
||||
var spawn = require('child_process').spawn;
|
||||
|
|
|
|||
|
|
@ -13,21 +13,19 @@
|
|||
repeat: function(name, t, fn){
|
||||
function _onTimeout(){
|
||||
fn(function next(ret, err){
|
||||
if(ret){
|
||||
clearTimeout(i);
|
||||
delete _timeouts[name];
|
||||
} else {
|
||||
// restart the timeout if it did not exit
|
||||
setTimeout(_onTimeout, t);
|
||||
if(!ret) {
|
||||
if(!_timeouts[name] || !_timeouts[name].cleared)
|
||||
_timeouts[name] = setTimeout(_onTimeout, t);
|
||||
}
|
||||
});
|
||||
}
|
||||
var i = setTimeout(_onTimeout, t); _onTimeout();
|
||||
_timeouts[name] = i;
|
||||
//_timeouts[name] = setTimeout(_onTimeout, t);
|
||||
_onTimeout();
|
||||
},
|
||||
$clearAll: function(){
|
||||
Object.keys(_timeouts).map(function(t){
|
||||
clearTimeout(t);
|
||||
clearTimeout(_timeouts[t]);
|
||||
_timeouts[t].cleared = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
global.JUCI = require("../../../../tests/lib-juci");
|
||||
require("../../../../tests/lib-juci");
|
||||
require("../dropbear");
|
||||
|
||||
describe("Dropbear", function(){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!javascript
|
||||
global.JUCI = require("../../../../tests/lib-juci");
|
||||
require("../../../../tests/lib-juci");
|
||||
require("../wifi");
|
||||
|
||||
var completed = {
|
||||
|
|
@ -17,10 +17,6 @@ describe("Wireless", function(){
|
|||
it("should have wireless config", function(){
|
||||
expect($uci.wireless).to.be.an(Object);
|
||||
});
|
||||
it("should have broadcom config", function(){
|
||||
expect($uci.broadcom).to.be.an(Object);
|
||||
expect($uci.broadcom["@all"]).not.to.be.empty();
|
||||
});
|
||||
it("should have hosts config", function(){
|
||||
expect($uci.hosts).to.be.ok();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ function JUCIMock(){
|
|||
console.log("JUCI.app.controller("+name+")");
|
||||
_controllers[name] = fn;
|
||||
return self.app;
|
||||
}
|
||||
},
|
||||
config: function(){}
|
||||
}
|
||||
function LocalStorageMock(){
|
||||
var _items = {};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue