Merge pull request from strongloop/update-deps

Drop support for Node.js 4.x + update dependencies
This commit is contained in:
Miroslav Bajtoš 2018-06-14 09:33:23 +02:00 committed by GitHub
commit 45cbee7602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 69 deletions

1
.npmrc Normal file
View File

@ -0,0 +1 @@
package-lock=false

View File

@ -1,5 +1,6 @@
sudo: false sudo: false
language: node_js language: node_js
node_js: node_js:
- "4"
- "6" - "6"
- "8"
- "10"

View File

@ -3,7 +3,7 @@
"version": "4.4.0", "version": "4.4.0",
"description": "Building blocks for LoopBack connectors", "description": "Building blocks for LoopBack connectors",
"engines": { "engines": {
"node": ">=4" "node": ">=6"
}, },
"keywords": [ "keywords": [
"StrongLoop", "StrongLoop",
@ -25,15 +25,15 @@
"async": "^2.1.5", "async": "^2.1.5",
"bluebird": "^3.4.6", "bluebird": "^3.4.6",
"debug": "^3.1.0", "debug": "^3.1.0",
"msgpack5": "^3.4.1", "msgpack5": "^4.2.0",
"strong-globalize": "^3.1.0", "strong-globalize": "^4.1.1",
"uuid": "^3.0.1" "uuid": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"chai": "~3.5.0", "chai": "^4.1.2",
"eslint": "^3.17.1", "eslint": "^4.19.1",
"eslint-config-loopback": "^8.0.0", "eslint-config-loopback": "^10.0.0",
"loopback-datasource-juggler": "^3.12.0", "loopback-datasource-juggler": "^3.12.0",
"mocha": "^3.2.0" "mocha": "^5.2.0"
} }
} }

View File

@ -173,24 +173,26 @@ describe('transactions', function() {
}); });
describe('timeout', function() { describe('timeout', function() {
const TIMEOUT = 50;
before(function() { before(function() {
// Reset the collection // Reset the collection
db.connector.data = {}; db.connector.data = {};
}); });
var post = {title: 't3', content: 'c3'}; var post = {title: 't3', content: 'c3'};
before(createPostInTx(post, 50)); beforeEach(createPostInTx(post, TIMEOUT));
it('should report timeout', function(done) { it('should report timeout', function(done) {
setTimeout(function() { // wait until the "create post" transaction times out
setTimeout(runTheTest, TIMEOUT * 3);
function runTheTest() {
Post.find({where: {title: 't3'}}, {transaction: currentTx}, Post.find({where: {title: 't3'}}, {transaction: currentTx},
function(err, posts) { function(err, posts) {
if (err) return done(err); expect(err).to.match(/transaction.*not active/);
expect(posts.length).to.be.eql(1);
done(); done();
}); });
}, 300); }
done();
}); });
it('should invoke the timeout hook', function(done) { it('should invoke the timeout hook', function(done) {
@ -198,6 +200,10 @@ describe('transactions', function() {
next(); next();
done(); done();
}); });
// If the event is not fired quickly enough, then the test can
// quickly fail - no need to wait full two seconds (Mocha's default)
this.timeout(TIMEOUT * 3);
}); });
}); });