Upgrade dependecies, fix new linter errors

This commit is contained in:
Miroslav Bajtoš 2018-06-29 17:15:45 +02:00
parent fcaa7adc61
commit ea61dfdb3a
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
2 changed files with 59 additions and 59 deletions

View File

@ -27,13 +27,13 @@
}, },
"devDependencies": { "devDependencies": {
"async-1.5.2": "file:./test/stub-modules/async-1.5.2", "async-1.5.2": "file:./test/stub-modules/async-1.5.2",
"chai": "^3.5.0", "chai": "^4.1.2",
"dirty-chai": "^1.2.2", "dirty-chai": "^2.0.1",
"eslint": "^3.14.1", "eslint": "^5.0.1",
"eslint-config-loopback": "^8.0.0", "eslint-config-loopback": "^10.0.0",
"loopback": "^3.0.0", "loopback": "^3.0.0",
"mocha": "^2.5.3", "mocha": "^5.2.0",
"supertest": "^1.2.0", "supertest": "^3.1.0",
"when-3.7.7": "file:./test/stub-modules/when-3.7.7" "when-3.7.7": "file:./test/stub-modules/when-3.7.7"
} }
} }

View File

@ -52,7 +52,7 @@ describe('LoopBack Context', function() {
TestModel.test = function(inst, cb) { TestModel.test = function(inst, cb) {
var tmpCtx = LoopBackContext.getCurrentContext(); var tmpCtx = LoopBackContext.getCurrentContext();
if (tmpCtx) tmpCtx.set('data', 'a value stored in context'); if (tmpCtx) tmpCtx.set('data', 'a value stored in context');
if (process.domain) cb = process.domain.bind(cb); // IMPORTANT if (process.domain) cb = process.domain.bind(cb); // IMPORTANT
runInOtherDomain(cb); runInOtherDomain(cb);
}; };
@ -106,53 +106,53 @@ describe('LoopBack Context', function() {
// https://gist.github.com/marlonkjoseph/f42f3c71f746896a0d4b7279a34ea753 // https://gist.github.com/marlonkjoseph/f42f3c71f746896a0d4b7279a34ea753
// Heavily edited by others // Heavily edited by others
it('keeps context when using waterfall() from async 1.5.2', it('keeps context when using waterfall() from async 1.5.2',
function(done) { function(done) {
LoopBackContext.runInContext(function() { LoopBackContext.runInContext(function() {
// Trigger async waterfall callbacks // Trigger async waterfall callbacks
asyncV152.waterfall([ asyncV152.waterfall([
function pushToContext(next) { function pushToContext(next) {
var ctx = LoopBackContext.getCurrentContext(); var ctx = LoopBackContext.getCurrentContext();
expect(ctx).is.an('object'); expect(ctx).is.an('object');
ctx.set('test-key', 'test-value'); ctx.set('test-key', 'test-value');
next(); next();
}, },
function pullFromContext(next) { function pullFromContext(next) {
var ctx = LoopBackContext.getCurrentContext(); var ctx = LoopBackContext.getCurrentContext();
expect(ctx).is.an('object'); expect(ctx).is.an('object');
var testValue = ctx && ctx.get('test-key', 'test-value'); var testValue = ctx && ctx.get('test-key', 'test-value');
next(null, testValue); next(null, testValue);
}, },
function verify(testValue, next) { function verify(testValue, next) {
expect(testValue).to.equal('test-value'); expect(testValue).to.equal('test-value');
next(); next();
}, },
], done); ], done);
});
}); });
});
it('handles concurrent then() calls with when v3.7.7 promises & bind option', it('handles concurrent then() calls with when v3.7.7 promises & bind option',
function() { function() {
return Promise.all([ return Promise.all([
runWithPushedValue('test-value-1', {bind: true}), runWithPushedValue('test-value-1', {bind: true}),
runWithPushedValue('test-value-2', {bind: true}), runWithPushedValue('test-value-2', {bind: true}),
]) ])
.then(function verify(values) { .then(function verify(values) {
var failureCount = getFailureCount(values); var failureCount = getFailureCount(values);
expect(failureCount).to.equal(0); expect(failureCount).to.equal(0);
});
}); });
});
it('fails once without bind option and when v3.7.7 promises', it('fails once without bind option and when v3.7.7 promises',
function() { function() {
return Promise.all([ return Promise.all([
runWithPushedValue('test-value-3'), runWithPushedValue('test-value-3'),
runWithPushedValue('test-value-4'), runWithPushedValue('test-value-4'),
]) ])
.then(function verify(values) { .then(function verify(values) {
var failureCount = getFailureCount(values); var failureCount = getFailureCount(values);
expect(failureCount).to.equal(1); expect(failureCount).to.equal(1);
});
}); });
});
var timeout = 100; var timeout = 100;
@ -191,23 +191,23 @@ describe('LoopBack Context', function() {
runWithRequestId('test-value-5', true), runWithRequestId('test-value-5', true),
runWithRequestId('test-value-6', true), runWithRequestId('test-value-6', true),
]) ])
.then(function verify(values) { .then(function verify(values) {
var failureCount = getFailureCount(values); var failureCount = getFailureCount(values);
expect(failureCount).to.equal(0); expect(failureCount).to.equal(0);
}); });
}); });
it('fails & mixes up ctx among requests in mw chains if next() cb is unbound', it('fails & mixes up ctx among requests in mw chains if next() cb is unbound',
function() { function() {
return Promise.all([ return Promise.all([
runWithRequestId('test-value-7'), runWithRequestId('test-value-7'),
runWithRequestId('test-value-8'), runWithRequestId('test-value-8'),
]) ])
.then(function verify(values) { .then(function verify(values) {
var failureCount = getFailureCount(values); var failureCount = getFailureCount(values);
expect(failureCount).to.equal(1); expect(failureCount).to.equal(1);
});
}); });
});
function runWithRequestId(pushedValue, bindNextCb) { function runWithRequestId(pushedValue, bindNextCb) {
return new Promise(function chainExecutor(outerResolve, reject) { return new Promise(function chainExecutor(outerResolve, reject) {