You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Add jshint and fix errors accordingly (including broken tests)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// helper to start and stop the redis process.
|
||||
var cp = require('child_process');
|
||||
var config = require('./config');
|
||||
@@ -5,6 +7,26 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
var tcpPortUsed = require('tcp-port-used');
|
||||
|
||||
// wait for redis to be listening in
|
||||
// all three modes (ipv4, ipv6, socket).
|
||||
function waitForRedis (available, cb) {
|
||||
var ipV4 = false;
|
||||
var id = setInterval(function () {
|
||||
tcpPortUsed.check(config.PORT, '127.0.0.1')
|
||||
.then(function (_ipV4) {
|
||||
ipV4 = _ipV4;
|
||||
return tcpPortUsed.check(config.PORT, '::1');
|
||||
})
|
||||
.then(function (ipV6) {
|
||||
if (ipV6 === available && ipV4 === available &&
|
||||
fs.existsSync('/tmp/redis.sock') === available) {
|
||||
clearInterval(id);
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
start: function (done, conf) {
|
||||
// spawn redis with our testing configuration.
|
||||
@@ -18,9 +40,9 @@ module.exports = {
|
||||
console.error('failed to starting redis with exit code "' + code + '" ' +
|
||||
'stop any other redis processes currently running (' +
|
||||
'hint: lsof -i :6379)');
|
||||
process.exit(code)
|
||||
process.exit(code);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// wait for redis to become available, by
|
||||
// checking the port we bind on.
|
||||
@@ -44,23 +66,3 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// wait for redis to be listening in
|
||||
// all three modes (ipv4, ipv6, socket).
|
||||
function waitForRedis (available, cb) {
|
||||
var ipV4 = false;
|
||||
var id = setInterval(function () {
|
||||
tcpPortUsed.check(config.PORT, '127.0.0.1')
|
||||
.then(function (_ipV4) {
|
||||
ipV4 = _ipV4;
|
||||
return tcpPortUsed.check(config.PORT, '::1');
|
||||
})
|
||||
.then(function (ipV6) {
|
||||
if (ipV6 === available && ipV4 === available &&
|
||||
fs.existsSync('/tmp/redis.sock') === available) {
|
||||
clearInterval(id);
|
||||
return cb();
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
Reference in New Issue
Block a user