Merge pull request #1594 from strongloop/upgrade-deps

Drop support for Node.js 4.x + update dependencies
This commit is contained in:
Miroslav Bajtoš 2018-06-12 16:26:07 +02:00 committed by GitHub
commit 751fd7b245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 2593 additions and 2570 deletions

1
.npmrc Normal file
View File

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

View File

@ -1,8 +1,8 @@
sudo: false sudo: false
language: node_js language: node_js
node_js: node_js:
- "4"
- "6" - "6"
- "8" - "8"
- "10"
after_success: npm run coverage after_success: npm run coverage

View File

@ -15,7 +15,7 @@
"ORM" "ORM"
], ],
"engines": { "engines": {
"node": ">=4.0.0" "node": ">=6"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -37,12 +37,12 @@
"@types/node": "^10.0.8", "@types/node": "^10.0.8",
"async-iterators": "^0.2.2", "async-iterators": "^0.2.2",
"bson": "^1.0.4", "bson": "^1.0.4",
"coveralls": "^2.13.1", "coveralls": "^3.0.1",
"eslint": "^3.12.2", "eslint": "^4.19.1",
"eslint-config-loopback": "^8.0.0", "eslint-config-loopback": "^10.0.0",
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing", "loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
"mocha": "^3.2.0", "mocha": "^5.2.0",
"nyc": "^11.1.0", "nyc": "^12.0.2",
"should": "^8.4.0", "should": "^8.4.0",
"typescript": "^2.8.3" "typescript": "^2.8.3"
}, },
@ -57,7 +57,7 @@
"minimatch": "^3.0.3", "minimatch": "^3.0.3",
"qs": "^6.5.0", "qs": "^6.5.0",
"shortid": "^2.2.6", "shortid": "^2.2.6",
"strong-globalize": "^3.1.0", "strong-globalize": "^4.1.1",
"traverse": "^0.6.6", "traverse": "^0.6.6",
"uuid": "^3.0.1" "uuid": "^3.0.1"
}, },

View File

@ -90,6 +90,7 @@ function clearAndCreate(model, data, callback) {
} }
} }
/* eslint-disable mocha/handle-done-callback */
function testOrm(dataSource) { function testOrm(dataSource) {
var requestsAreCounted = dataSource.name !== 'mongodb'; var requestsAreCounted = dataSource.name !== 'mongodb';

View File

@ -124,7 +124,7 @@ describe('DataSource', function() {
/** /**
* new DataSource(dsName, connectorInstance) * new DataSource(dsName, connectorInstance)
*/ */
it('should accept resolved connector', function() { it('should accept dsName and resolved connector', function() {
var mockConnector = { var mockConnector = {
name: 'loopback-connector-mock', name: 'loopback-connector-mock',
initialize: function(ds, cb) { initialize: function(ds, cb) {

View File

@ -667,6 +667,7 @@ describe('default scope', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find a scoped instance - thing', function(done) { it('should find a scoped instance - thing', function(done) {
Product.find({where: {name: 'Product'}}, function(err, products) { Product.find({where: {name: 'Product'}}, function(err, products) {
products.should.have.length(2); products.should.have.length(2);

View File

@ -659,6 +659,7 @@ describe('include', function() {
bdd.describeIf(connectorCapabilities.adhocSort === false, bdd.describeIf(connectorCapabilities.adhocSort === false,
'findWithForeignKeysByPage', function() { 'findWithForeignKeysByPage', function() {
// eslint-disable-next-line mocha/no-identical-title
context('filter', function() { context('filter', function() {
it('works when using a `where` with a foreign key', function(done) { it('works when using a `where` with a foreign key', function(done) {
User.findOne({ User.findOne({
@ -829,6 +830,7 @@ describe('include', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
context('pagination', function() { context('pagination', function() {
it('works with the default page size (0) and `inqlimit` is exceeded', it('works with the default page size (0) and `inqlimit` is exceeded',
function(done) { function(done) {
@ -865,6 +867,7 @@ describe('include', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
context('relations', function() { context('relations', function() {
// WARNING // WARNING
// The code paths for in this suite of tests were verified manually due to // The code paths for in this suite of tests were verified manually due to

View File

@ -36,19 +36,17 @@ describe('include_util', function() {
result.get(11)['letter'].should.equal('HA!'); result.get(11)['letter'].should.equal('HA!');
result.get(33)['letter'].should.equal('C'); result.get(33)['letter'].should.equal('C');
}); });
});
describe('#buildOneToOneIdentityMapWithOrigKeys', function() { it('should return an object with no additional keys', function() {
it('should return an object with keys', function() {
var objs = [ var objs = [
{id: 11, letter: 'A'}, {id: 11, letter: 'A'},
{id: 22, letter: 'B'}, {id: 22, letter: 'B'},
]; ];
var result = includeUtils.buildOneToOneIdentityMapWithOrigKeys(objs, 'id'); var result = includeUtils.buildOneToOneIdentityMapWithOrigKeys(objs, 'id');
result.get(11).should.be.ok; result.getKeys().should.eql([11, 22]); // no additional properties
result.get(22).should.be.ok;
result.getKeys().should.have.lengthOf(2); // no additional properties
}); });
}); });
describe('#buildOneToManyIdentityMap', function() { describe('#buildOneToManyIdentityMap', function() {
it('should return an object with keys', function() { it('should return an object with keys', function() {
var objs = [ var objs = [

View File

@ -971,7 +971,7 @@ describe('DataSource connector types', function() {
}); });
}); });
describe('DataSource constructor', function() { describe('DataSource._resolveConnector', function() {
// Mocked require // Mocked require
var loader = function(name) { var loader = function(name) {
if (name.indexOf('./connectors/') !== -1) { if (name.indexOf('./connectors/') !== -1) {

View File

@ -1279,6 +1279,7 @@ describe('manipulation', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('works on create if the request does not include an id', function(done) { it('works on create if the request does not include an id', function(done) {
var post = {title: 'a', content: 'AAA'}; var post = {title: 'a', content: 'AAA'};
Post.replaceOrCreate(post, function(err, p) { Post.replaceOrCreate(post, function(err, p) {
@ -1289,6 +1290,7 @@ describe('manipulation', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('works on update if the request includes an existing id in db', function(done) { it('works on update if the request includes an existing id in db', function(done) {
Post.create({title: 'a', content: 'AAA'}, Post.create({title: 'a', content: 'AAA'},
function(err, post) { function(err, post) {
@ -1757,11 +1759,13 @@ describe('manipulation', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should be defined as function', function() { it('should be defined as function', function() {
Person.deleteAll.should.be.a.Function; Person.deleteAll.should.be.a.Function;
Person.destroyAll.should.be.a.Function; Person.destroyAll.should.be.a.Function;
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should only delete instances that satisfy the where condition', it('should only delete instances that satisfy the where condition',
function(done) { function(done) {
Person.deleteAll({id: idJohn}, function(err, info) { Person.deleteAll({id: idJohn}, function(err, info) {
@ -1780,6 +1784,7 @@ describe('manipulation', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should report zero deleted instances when no matches are found', it('should report zero deleted instances when no matches are found',
function(done) { function(done) {
var unknownId = uid.fromConnector(db) || 1234567890; var unknownId = uid.fromConnector(db) || 1234567890;
@ -1794,6 +1799,7 @@ describe('manipulation', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should delete all instances when the where condition is not provided', it('should delete all instances when the where condition is not provided',
function(done) { function(done) {
Person.deleteAll(function(err, info) { Person.deleteAll(function(err, info) {
@ -1933,7 +1939,7 @@ describe('manipulation', function() {
person.isNewRecord().should.be.true; person.isNewRecord().should.be.true;
}); });
describe('Date $now function', function() { describe('Date $now function (type: Date)', function() {
var CustomModel; var CustomModel;
before(function(done) { before(function(done) {
@ -1957,7 +1963,7 @@ describe('manipulation', function() {
}); });
}); });
describe('Date $now function', function() { describe('Date $now function (type: String)', function() {
var CustomModel; var CustomModel;
before(function(done) { before(function(done) {

View File

@ -962,14 +962,6 @@ describe('Memory connector with options', function() {
}); });
}); });
it('should receive options from the find method', function(done) {
var opts = {transaction: 'tx2'};
Post.find({}, opts, function(err, p) {
savedOptions.find.should.be.eql(opts);
done(err);
});
});
it('should treat first object arg as filter for find', function(done) { it('should treat first object arg as filter for find', function(done) {
var filter = {title: 't1'}; var filter = {title: 't1'};
Post.find(filter, function(err, p) { Post.find(filter, function(err, p) {

View File

@ -2258,7 +2258,7 @@ module.exports = function(dataSource, should, connectorCapabilities) {
}); });
if (!dataSource.connector.replaceById) { if (!dataSource.connector.replaceById) {
describe.skip('replaceById - not implemented', function() {}); describe.skip('replaceOrCreate - not implemented', function() {});
} else { } else {
describe('PersistedModel.replaceOrCreate', function() { describe('PersistedModel.replaceOrCreate', function() {
it('triggers hooks in the correct order on create', function(done) { it('triggers hooks in the correct order on create', function(done) {

View File

@ -1777,6 +1777,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find records on scope', function(done) { it('should find records on scope', function(done) {
Category.findOne(function(err, c) { Category.findOne(function(err, c) {
should.not.exists(err); should.not.exists(err);
@ -1801,6 +1802,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find record on scope - scoped', function(done) { it('should find record on scope - scoped', function(done) {
Category.findOne(function(err, c) { Category.findOne(function(err, c) {
should.not.exists(err); should.not.exists(err);
@ -2647,6 +2649,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find polymorphic items - article', function(done) { it('should find polymorphic items - article', function(done) {
Article.findOne({where: {name: 'Article 2'}}, function(err, article) { Article.findOne({where: {name: 'Article 2'}}, function(err, article) {
should.not.exists(err); should.not.exists(err);
@ -2659,6 +2662,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find the inverse of polymorphic relation - article', function(done) { it('should find the inverse of polymorphic relation - article', function(done) {
Picture.findOne({where: {name: 'Sample'}}, function(err, p) { Picture.findOne({where: {name: 'Sample'}}, function(err, p) {
if (err) return done(err); if (err) return done(err);
@ -2902,6 +2906,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should create polymorphic through model', function(done) { it('should create polymorphic through model', function(done) {
if (!anotherPicture) return done(); if (!anotherPicture) return done();
PictureLink.findOne({where: {pictureId: anotherPicture.id, imageableType: 'Article'}}, PictureLink.findOne({where: {pictureId: anotherPicture.id, imageableType: 'Article'}},
@ -2915,6 +2920,7 @@ describe('relations', function() {
}); });
var anotherArticle, anotherEmployee; var anotherArticle, anotherEmployee;
// eslint-disable-next-line mocha/no-identical-title
it('should add to a polymorphic relation - article', function(done) { it('should add to a polymorphic relation - article', function(done) {
Article.create({name: 'Article 2'}, function(err, article) { Article.create({name: 'Article 2'}, function(err, article) {
if (err) return done(err); if (err) return done(err);
@ -2927,6 +2933,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should add to a polymorphic relation - article', function(done) { it('should add to a polymorphic relation - article', function(done) {
Employee.create({name: 'Employee 2'}, function(err, reader) { Employee.create({name: 'Employee 2'}, function(err, reader) {
if (err) return done(err); if (err) return done(err);
@ -3032,6 +3039,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should check if polymorphic relation exists - article', function(done) { it('should check if polymorphic relation exists - article', function(done) {
if (!article) return done(); if (!article) return done();
Article.findById(article.id, function(err, article) { Article.findById(article.id, function(err, article) {
@ -4519,6 +4527,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should get an embedded item on scope - verify', function(done) { it('should get an embedded item on scope - verify', function(done) {
Person.findById(personId, function(err, p) { Person.findById(personId, function(err, p) {
if (err) return done(err); if (err) return done(err);
@ -4632,6 +4641,7 @@ describe('relations', function() {
}).catch(done); }).catch(done);
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should get an embedded item on scope with promises - verify', function(done) { it('should get an embedded item on scope with promises - verify', function(done) {
Person.findById(personId) Person.findById(personId)
.then(function(p) { .then(function(p) {
@ -4828,6 +4838,7 @@ describe('relations', function() {
Person.definition.properties.addresses.postgresql.should.eql({dataType: 'json'}); Person.definition.properties.addresses.postgresql.should.eql({dataType: 'json'});
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should create embedded items on scope', function(done) { it('should create embedded items on scope', function(done) {
Person.findOne(function(err, p) { Person.findOne(function(err, p) {
p.addressList.create({street: 'Street 2'}, function(err, address) { p.addressList.create({street: 'Street 2'}, function(err, address) {
@ -4970,6 +4981,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should create embedded items on scope', function(done) { it('should create embedded items on scope', function(done) {
Person.findOne(function(err, p) { Person.findOne(function(err, p) {
p.addressList.create({street: 'Street 3'}, function(err, address) { p.addressList.create({street: 'Street 3'}, function(err, address) {
@ -5224,6 +5236,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should have embedded items - verify', function(done) { it('should have embedded items - verify', function(done) {
Person.findOne({where: {name: 'Wilma'}}, function(err, p) { Person.findOne({where: {name: 'Wilma'}}, function(err, p) {
p.name.should.equal('Wilma'); p.name.should.equal('Wilma');
@ -5549,6 +5562,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope', function(done) { it('should find items on scope', function(done) {
Category.findOne(function(err, cat) { Category.findOne(function(err, cat) {
if (err) return done(err); if (err) return done(err);
@ -5604,6 +5618,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope', function(done) { it('should find items on scope', function(done) {
Category.findById(category.id, function(err, cat) { Category.findById(category.id, function(err, cat) {
if (err) return done(err); if (err) return done(err);
@ -5952,6 +5967,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should add a record to scope - object', function(done) { it('should add a record to scope - object', function(done) {
Category.findOne(function(err, cat) { Category.findOne(function(err, cat) {
cat.jobs.add(job3.id, function(err, prod) { cat.jobs.add(job3.id, function(err, prod) {
@ -5967,6 +5983,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope - findById', function(done) { it('should find items on scope - findById', function(done) {
Category.findOne(function(err, cat) { Category.findOne(function(err, cat) {
cat.jobs.findById(job3.id, function(err, p) { cat.jobs.findById(job3.id, function(err, p) {
@ -6090,6 +6107,7 @@ describe('relations', function() {
}); });
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope - verify', function(done) { it('should find items on scope - verify', function(done) {
Category.findOne(function(err, cat) { Category.findOne(function(err, cat) {
cat.jobIds.should.have.lengthOf(1); cat.jobIds.should.have.lengthOf(1);
@ -6252,6 +6270,7 @@ describe('relations', function() {
.catch(done); .catch(done);
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should add a record to scope with promises - object', function(done) { it('should add a record to scope with promises - object', function(done) {
Category.findOne() Category.findOne()
.then(function(cat) { .then(function(cat) {
@ -6268,6 +6287,7 @@ describe('relations', function() {
.catch(done); .catch(done);
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope with promises - findById', function(done) { it('should find items on scope with promises - findById', function(done) {
Category.findOne() Category.findOne()
.then(function(cat) { .then(function(cat) {
@ -6397,6 +6417,7 @@ describe('relations', function() {
.catch(done); .catch(done);
}); });
// eslint-disable-next-line mocha/no-identical-title
it('should find items on scope with promises - verify', function(done) { it('should find items on scope with promises - verify', function(done) {
Category.findOne() Category.findOne()
.then(function(cat) { .then(function(cat) {

View File

@ -127,7 +127,7 @@ describe('util.parseSettings', function() {
should.equal(settings.url, 'mysql://127.0.0.1:3306/mydb?x[a]=1&x[b]=2&engine=InnoDB'); should.equal(settings.url, 'mysql://127.0.0.1:3306/mydb?x[a]=1&x[b]=2&engine=InnoDB');
}); });
it('Parse a url without auth into a settings object', function() { it('Parse a Memory url without auth into a settings object', function() {
var url = 'memory://?x=1'; var url = 'memory://?x=1';
var settings = utils.parseSettings(url); var settings = utils.parseSettings(url);
should.equal(settings.hostname, ''); should.equal(settings.hostname, '');