不要怂,就是干,撸起袖子干!

Commit 81a72115 by Sushant Committed by GitHub

chores: updated various dev dependencies (#8736)

1 parent ed111c0c
......@@ -55,9 +55,9 @@
"wkx": "^0.4.1"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^5.3.0",
"chai-datetime": "^1.4.1",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-datetime": "^1.5.0",
"chai-spies": "^0.7.1",
"cheerio": "^1.0.0-rc.2",
"commitizen": "^2.9.6",
......@@ -72,16 +72,16 @@
"husky": "^0.14.2",
"istanbul": "^0.4.5",
"lcov-result-merger": "^1.2.0",
"mocha": "^3.0.2",
"mocha": "^4.0.1",
"mysql2": "^1.5.1",
"pg": "^6.1.0",
"pg-hstore": "^2.3.2",
"pg-native": "^1.10.0",
"pg-types": "^1.11.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.6",
"sinon-chai": "^2.13.0",
"sqlite3": "^3.1.4",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"sqlite3": "^3.1.13",
"tedious": "1.14.0",
"uuid-validate": "^0.0.2",
"validate-commit-msg": "^2.12.2"
......@@ -97,6 +97,9 @@
"object relational mapper"
],
"main": "index",
"options": {
"mocha": "--globals setImmediate,clearImmediate --ui tdd --exit --check-leaks --colors -t 30000 --reporter spec"
},
"scripts": {
"lint": "eslint lib test --quiet",
"test": "npm run teaser && npm run test-unit && npm run test-integration",
......@@ -105,14 +108,14 @@
"test-docker-integration": "env-cmd ./test/config/.docker.env npm run test-integration",
"docs": "esdoc && cp docs/ROUTER esdoc/ROUTER",
"teaser": "node -e \"console.log('#'.repeat(process.env.DIALECT.length + 22) + '\\n# Running tests for ' + process.env.DIALECT + ' #\\n' + '#'.repeat(process.env.DIALECT.length + 22))\"",
"test-unit": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/unit/**/*.js\"",
"test-unit": "mocha $npm_package_options_mocha \"test/unit/**/*.js\"",
"test-unit-mysql": "cross-env DIALECT=mysql npm run test-unit",
"test-unit-postgres": "cross-env DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "cross-env DIALECT=postgres-native npm run test-unit",
"test-unit-sqlite": "cross-env DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "cross-env DIALECT=mssql npm run test-unit",
"test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite",
"test-integration": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/integration/**/*.test.js\"",
"test-integration": "mocha $npm_package_options_mocha \"test/integration/**/*.test.js\"",
"test-integration-mysql": "cross-env DIALECT=mysql npm run test-integration",
"test-integration-postgres": "cross-env DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "cross-env DIALECT=postgres-native npm run test-integration",
......@@ -128,8 +131,8 @@
"test-mssql": "cross-env DIALECT=mssql npm test",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql",
"cover": "rimraf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage",
"cover-integration": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 60000 --ui tdd \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 30000 --ui tdd \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"cover-integration": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 60000 --exit --ui tdd \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 30000 --exit --ui tdd \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"",
"sscce": "env-cmd ./test/config/.docker.env node sscce.js",
"sscce-mysql": "cross-env DIALECT=mysql npm run sscce",
......
......@@ -1930,8 +1930,8 @@ describe(Support.getTestDialectTeaser('Model'), () => {
expect(m.createdAt).to.be.ok;
expect(m.created_at).to.not.exist;
expect(m.secret_given).to.not.exist;
expect(m.get('secret_given')).not.to.be.defined;
expect(m.get('created_at')).not.to.be.defined;
expect(m.get('secret_given')).to.be.undefined;
expect(m.get('created_at')).to.be.undefined;
// values look fine
expect(m.id).to.be.eql(M2.id);
......
......@@ -88,7 +88,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
}
}).then(users => {
expect(users).to.have.length(1);
expect(users[0].binary).to.be.an.instanceof.string;
expect(users[0].binary.toString()).to.equal(this.buf.toString());
expect(users[0].username).to.equal('boo2');
});
});
......@@ -276,8 +276,6 @@ describe(Support.getTestDialectTeaser('Model'), () => {
return _user.setBinary(_binary).then(() => {
return _user.getBinary().then(_binaryRetrieved => {
return user.getBinary().then(binaryRetrieved => {
expect(binaryRetrieved.id).to.be.an.instanceof.string;
expect(_binaryRetrieved.id).to.be.an.instanceof.string;
expect(binaryRetrieved.id).to.have.length(16);
expect(_binaryRetrieved.id).to.have.length(16);
expect(binaryRetrieved.id.toString()).to.be.equal(buf1.toString());
......
......@@ -27,9 +27,10 @@ describe(Support.getTestDialectTeaser('Pooling'), function() {
}
});
this.sinon.stub(this.testInstance.connectionManager, '_connect', () => new Sequelize.Promise(() => {}));
this.sinon.stub(this.testInstance.connectionManager, '_connect')
.returns(new Sequelize.Promise(() => {}));
return expect(this.testInstance.authenticate())
.to.eventually.be.rejectedWith('TimeoutError: ResourceRequest timed out');
.to.eventually.be.rejectedWith('ResourceRequest timed out');
});
});
......@@ -186,7 +186,7 @@ if (current.dialect.supports.transactions) {
return t.commit();
});
})
).to.be.rejectedWith('Error: Transaction cannot be committed because it has been finished with state: commit');
).to.be.rejectedWith('Transaction cannot be committed because it has been finished with state: commit');
});
it('does not allow commits after rollback', function() {
......@@ -195,7 +195,7 @@ if (current.dialect.supports.transactions) {
return t.rollback().then(() => {
return t.commit();
});
})).to.be.rejectedWith('Error: Transaction cannot be committed because it has been finished with state: rollback');
})).to.be.rejectedWith('Transaction cannot be committed because it has been finished with state: rollback');
});
it('does not allow rollbacks after commit', function() {
......@@ -204,7 +204,7 @@ if (current.dialect.supports.transactions) {
return t.commit().then(() => {
return t.rollback();
});
})).to.be.rejectedWith('Error: Transaction cannot be rolled back because it has been finished with state: commit');
})).to.be.rejectedWith('Transaction cannot be rolled back because it has been finished with state: commit');
});
it('does not allow rollbacks after rollback', function() {
......@@ -213,7 +213,7 @@ if (current.dialect.supports.transactions) {
return t.rollback().then(() => {
return t.rollback();
});
})).to.be.rejectedWith('Error: Transaction cannot be rolled back because it has been finished with state: rollback');
})).to.be.rejectedWith('Transaction cannot be rolled back because it has been finished with state: rollback');
});
it('works even if a transaction: null option is passed', function() {
......
......@@ -541,16 +541,17 @@ describe(Support.getTestDialectTeaser('belongsToMany'), () => {
Service.belongsToMany(Service, {through: 'Supplements', as: 'supplements'});
Service.belongsToMany(Service, {through: 'Supplements', as: {singular: 'supplemented', plural: 'supplemented'}});
expect(Service.prototype).to.have.property('getSupplements').which.is.a.function;
expect(Service.prototype).to.have.property('addSupplement').which.is.a.function;
expect(Service.prototype).to.have.property('addSupplements').which.is.a.function;
expect(Service.prototype).to.have.ownProperty('getSupplements').to.be.a('function');
expect(Service.prototype).to.have.property('getSupplemented').which.is.a.function;
expect(Service.prototype).not.to.have.property('getSupplementeds').which.is.a.function;
expect(Service.prototype).to.have.ownProperty('addSupplement').to.be.a('function');
expect(Service.prototype).to.have.ownProperty('addSupplements').to.be.a('function');
expect(Service.prototype).to.have.property('addSupplemented').which.is.a.function;
expect(Service.prototype).not.to.have.property('addSupplementeds').which.is.a.function;
expect(Service.prototype).to.have.ownProperty('getSupplemented').to.be.a('function');
expect(Service.prototype).not.to.have.ownProperty('getSupplementeds').to.be.a('function');
expect(Service.prototype).to.have.ownProperty('addSupplemented').to.be.a('function');
expect(Service.prototype).not.to.have.ownProperty('addSupplementeds').to.be.a('function');
});
});
......
......@@ -21,7 +21,7 @@ describe('[MSSQL]', () => {
isolationLevel: 'REPEATABLE_READ',
logging: false
};
sandbox.stub(connectionStub, 'beginTransaction', cb => {
sandbox.stub(connectionStub, 'beginTransaction').callsFake(cb => {
cb();
});
query = new Query(connectionStub, sequelize, options);
......
......@@ -387,7 +387,7 @@ describe(Support.getTestDialectTeaser('Hooks'), () => {
return self.sequelize.Promise.resolve();
});
return expect(this.Model.runHooks('beforeBulkCreate')).to.be.resolved;
return expect(this.Model.runHooks('beforeBulkCreate')).to.be.fulfilled;
});
it('can return undefined', function() {
......@@ -395,7 +395,7 @@ describe(Support.getTestDialectTeaser('Hooks'), () => {
// This space intentionally left blank
});
return expect(this.Model.runHooks('beforeBulkCreate')).to.be.resolved;
return expect(this.Model.runHooks('beforeBulkCreate')).to.be.fulfilled;
});
it('can return an error by rejecting', function() {
......
......@@ -101,7 +101,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('should run beforeValidate hook but not afterValidate hook when _validate is unsuccessful', () => {
const failingInstanceValidator = new InstanceValidator(this.User.build());
sinon.stub(failingInstanceValidator, '_validate', () => {
sinon.stub(failingInstanceValidator, '_validate').callsFake(() => {
return Promise.reject();
});
const beforeValidate = sinon.spy();
......@@ -126,7 +126,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
describe('validatedFailed hook', () => {
it('should call validationFailed hook when validation fails', () => {
const failingInstanceValidator = new InstanceValidator(this.User.build());
sinon.stub(failingInstanceValidator, '_validate', () => {
sinon.stub(failingInstanceValidator, '_validate').callsFake(() => {
return Promise.reject();
});
const validationFailedHook = sinon.spy();
......@@ -139,7 +139,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('should not replace the validation error in validationFailed hook by default', () => {
const failingInstanceValidator = new InstanceValidator(this.User.build());
sinon.stub(failingInstanceValidator, '_validate', () => {
sinon.stub(failingInstanceValidator, '_validate').callsFake(() => {
return Promise.reject(new SequelizeValidationError());
});
const validationFailedHook = sinon.stub().returns(Promise.resolve());
......@@ -152,7 +152,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
it('should replace the validation error if validationFailed hook creates a new error', () => {
const failingInstanceValidator = new InstanceValidator(this.User.build());
sinon.stub(failingInstanceValidator, '_validate', () => {
sinon.stub(failingInstanceValidator, '_validate').callsFake(() => {
return Promise.reject(new SequelizeValidationError());
});
const validationFailedHook = sinon.stub().throws(new Error('validation failed hook error'));
......
......@@ -79,7 +79,7 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
describe('custom setter', () => {
before(function() {
this.stubCreate = sinon.stub(current.getQueryInterface(), 'insert', instance => {
this.stubCreate = sinon.stub(current.getQueryInterface(), 'insert').callsFake(instance => {
return Promise.resolve([instance, 1]);
});
});
......
......@@ -10,22 +10,19 @@ const chai = require('chai'),
describe(Support.getTestDialectTeaser('Model'), () => {
describe('bulkCreate', () => {
const Model = current.define('model', {
accountId: {
type: DataTypes.INTEGER(11).UNSIGNED,
allowNull: false,
field: 'account_id'
}
}, { timestamps: false });
before(function() {
this.Model = current.define('model', {
accountId: {
type: DataTypes.INTEGER(11).UNSIGNED,
allowNull: false,
field: 'account_id'
}
}, { timestamps: false });
this.stub = sinon.stub(current.getQueryInterface(), 'bulkInsert', () => {
return Promise.resolve([]);
});
this.stub = sinon.stub(current.getQueryInterface(), 'bulkInsert').returns(Promise.resolve([]));
});
beforeEach(function() {
afterEach(function() {
this.stub.reset();
});
......@@ -35,9 +32,9 @@ describe(Support.getTestDialectTeaser('Model'), () => {
describe('validations', () => {
it('should not fail for renamed fields', function() {
return Model.bulkCreate([
return this.Model.bulkCreate([
{ accountId: 42 }
], { validate: true }).bind(this).then(function() {
], { validate: true }).then(() => {
expect(this.stub.getCall(0).args[1]).to.deep.equal([
{ account_id: 42, id: null }
]);
......
......@@ -16,14 +16,14 @@ describe(Support.getTestDialectTeaser('Model'), () => {
underscored: true
});
expect(Model.rawAttributes.createdAt).to.be.defined;
expect(Model.rawAttributes.updatedAt).to.be.defined;
expect(Model.rawAttributes).to.haveOwnProperty('createdAt');
expect(Model.rawAttributes).to.haveOwnProperty('updatedAt');
expect(Model._timestampAttributes.createdAt).to.equal('createdAt');
expect(Model._timestampAttributes.updatedAt).to.equal('updatedAt');
expect(Model.rawAttributes.created_at).not.to.be.defined;
expect(Model.rawAttributes.updated_at).not.to.be.defined;
expect(Model.rawAttributes).not.to.have.property('created_at');
expect(Model.rawAttributes).not.to.have.property('updated_at');
});
it('should throw when id is added but not marked as PK', () => {
......
......@@ -18,7 +18,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
});
before(function() {
this.stubDelete = sinon.stub(current.getQueryInterface(), 'bulkDelete', () => {
this.stubDelete = sinon.stub(current.getQueryInterface(), 'bulkDelete').callsFake(() => {
return Promise.resolve([]);
});
});
......
......@@ -52,7 +52,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
where = {prop: Math.random().toString()},
findSpy = this.sinon.stub(Model, 'findOne');
this.sinon.stub(Model, 'create', () => {
this.sinon.stub(Model, 'create').callsFake(() => {
return Promise.reject(new UniqueConstraintError());
});
......
......@@ -45,7 +45,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
}, { timestamps: false });
before(() => {
this.stub = sinon.stub(current.getQueryInterface(), 'select', () => {
this.stub = sinon.stub(current.getQueryInterface(), 'select').callsFake(() => {
return Model.build({});
});
this.warnOnInvalidOptionsStub = sinon.stub(Model, 'warnOnInvalidOptions');
......
......@@ -10,58 +10,49 @@ const chai = require('chai'),
_ = require('lodash');
describe(Support.getTestDialectTeaser('Model'), () => {
describe('method update', () => {
const User = current.define('User', {
name: DataTypes.STRING,
secretValue: DataTypes.INTEGER
});
before(function() {
this.stubUpdate = sinon.stub(current.getQueryInterface(), 'bulkUpdate', () => {
return Promise.resolve([]);
this.User = current.define('User', {
name: DataTypes.STRING,
secretValue: DataTypes.INTEGER
});
});
beforeEach(function() {
this.stubUpdate = sinon.stub(current.getQueryInterface(), 'bulkUpdate').returns(Promise.resolve([]));
this.updates = { name: 'Batman', secretValue: '7' };
this.cloneUpdates = _.clone(this.updates);
this.stubUpdate.reset();
});
afterEach(function() {
delete this.updates;
delete this.cloneUpdates;
this.stubUpdate.restore();
});
after(function() {
this.stubUpdate.restore();
afterEach(function() {
delete this.updates;
delete this.cloneUpdates;
});
describe('properly clones input values', () => {
it('with default options', function() {
const self = this;
return User.update(self.updates, {where: {secretValue: '1'}}).bind(this).then(() => {
expect(self.updates).to.be.deep.eql(self.cloneUpdates);
return this.User.update(this.updates, { where: { secretValue: '1' } }).then(() => {
expect(this.updates).to.be.deep.eql(this.cloneUpdates);
});
});
it('when using fields option', function() {
const self = this;
return User.update(self.updates, {where: {secretValue: '1'}, fields: ['name']}).bind(this).then(() => {
expect(self.updates).to.be.deep.eql(self.cloneUpdates);
return this.User.update(this.updates, { where: { secretValue: '1' }, fields: ['name'] }).then(() => {
expect(this.updates).to.be.deep.eql(this.cloneUpdates);
});
});
});
it('can detect complexe objects', function() {
const self = this;
const Where = function() { this.secretValue = '1'; };
expect(() => {
User.update(self.updates, {where: new Where()});
this.User.update(this.updates, { where: new Where() });
}).to.throw();
});
});
});
......@@ -45,7 +45,7 @@ describe(Support.getTestDialectTeaser('Model'), () => {
this.query = current.query;
current.query = sinon.stub().returns(Promise.resolve());
self.stub = sinon.stub(current.getQueryInterface(), 'upsert', () => {
self.stub = sinon.stub(current.getQueryInterface(), 'upsert').callsFake(() => {
return User.build({});
});
});
......
......@@ -272,7 +272,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), () => {
});
before(function() {
this.stub = sinon.stub(current, 'query', () => {
this.stub = sinon.stub(current, 'query').callsFake(() => {
return new Promise(resolve => {
resolve([User.build({}), 1]);
});
......
......@@ -10,13 +10,13 @@ const chai = require('chai'),
describe('sequelize.query', () => {
it('connection should be released only once when retry fails', () => {
const getConnectionStub = sinon.stub(current.connectionManager, 'getConnection', () => {
const getConnectionStub = sinon.stub(current.connectionManager, 'getConnection').callsFake(() => {
return Promise.resolve({});
});
const releaseConnectionStub = sinon.stub(current.connectionManager, 'releaseConnection', () => {
const releaseConnectionStub = sinon.stub(current.connectionManager, 'releaseConnection').callsFake(() => {
return Promise.resolve();
});
const queryStub = sinon.stub(current.dialect.Query.prototype, 'run', () => {
const queryStub = sinon.stub(current.dialect.Query.prototype, 'run').callsFake(() => {
return Promise.reject(new Error('wrong sql'));
});
return current.query('THIS IS A WRONG SQL', {
......
......@@ -25,13 +25,13 @@ if (current.dialect.name !== 'sqlite') {
before(function() {
this.stub = sinon.stub(current, 'query', sql => {
this.stub = sinon.stub(current, 'query').callsFake(sql => {
return Promise.resolve(sql);
});
});
beforeEach(function() {
this.stub.reset();
this.stub.resetHistory();
});
after(function() {
......
......@@ -23,9 +23,9 @@ describe('Transaction', function() {
});
beforeEach(() => {
this.stub.reset();
this.stubConnection.reset();
this.stubRelease.reset();
this.stub.resetHistory();
this.stubConnection.resetHistory();
this.stubRelease.resetHistory();
});
after(() => {
......
......@@ -245,25 +245,25 @@ suite(Support.getTestDialectTeaser('Utils'), () => {
const logger = Utils.getLogger();
test('deprecate', () => {
expect(logger.deprecate).to.be.function;
expect(logger.deprecate).to.be.a('function');
logger.deprecate('test deprecation');
});
test('debug', () => {
expect(logger.debug).to.be.function;
expect(logger.debug).to.be.a('function');
logger.debug('test debug');
});
test('warn', () => {
expect(logger.warn).to.be.function;
expect(logger.warn).to.be.a('function');
logger.warn('test warning');
});
test('debugContext', () => {
expect(logger.debugContext).to.be.function;
expect(logger.debugContext).to.be.a('function');
const testLogger = logger.debugContext('test');
expect(testLogger).to.be.function;
expect(testLogger).to.be.a('function');
expect(testLogger.namespace).to.be.eql('sequelize:test');
});
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!