Upgrade dependecies, fix new linter errors
This commit is contained in:
parent
fcaa7adc61
commit
ea61dfdb3a
12
package.json
12
package.json
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue