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

Commit 4c9e77fe by overlookmotel Committed by Jan Aagaard Meier

refactor(testing): Re-enable support shim, and extend to test options object not…

… being modified v2 (#5836)

* Update dev dependency `hints` used in tests support shim

* `Model.init` is not shimmed by test shims

* Tests support shim checks for options object being modified

* Fix JSDoc comments in tests shim

* Increase tests timeout to 30secs

* Environment var `SHIM` to trigger tests support shim
1 parent 1409aa8c
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
- [FIXED] Type validation now works with non-strings due to updated validator@5.0.0 [#5861](https://github.com/sequelize/sequelize/pull/5861) - [FIXED] Type validation now works with non-strings due to updated validator@5.0.0 [#5861](https://github.com/sequelize/sequelize/pull/5861)
- [FIXED] Improved offset and limit support for SQL server 2008 [#5616](https://github.com/sequelize/sequelize/pull/5616) - [FIXED] Improved offset and limit support for SQL server 2008 [#5616](https://github.com/sequelize/sequelize/pull/5616)
- [FIXED] options object cloned in all Sequelize methods (so not modified within Sequelize) - [FIXED] options object cloned in all Sequelize methods (so not modified within Sequelize)
- [ADDED] Test coverage for options object not being modified
# 3.23.1 # 3.23.1
- [FIXED] Postgres DECIMAL precision. (PostgreSQL) [#4893](https://github.com/sequelize/sequelize/issues/4893) - [FIXED] Postgres DECIMAL precision. (PostgreSQL) [#4893](https://github.com/sequelize/sequelize/issues/4893)
......
...@@ -571,7 +571,7 @@ class Model { ...@@ -571,7 +571,7 @@ class Model {
}); });
} }
static init(attributes, options, modelManager) { static init(attributes, options, modelManager) { // testhint options:none
this.options = Utils._.extend({ this.options = Utils._.extend({
timestamps: true, timestamps: true,
......
...@@ -97,14 +97,14 @@ ...@@ -97,14 +97,14 @@
"docs": "node docs/docs-generator.js", "docs": "node docs/docs-generator.js",
"jshint": "./node_modules/.bin/jshint lib test", "jshint": "./node_modules/.bin/jshint lib test",
"teaser": "echo ''; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\"; echo '# Running tests for '$DIALECT' #'; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\";echo '';", "teaser": "echo ''; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\"; echo '# Running tests for '$DIALECT' #'; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\";echo '';",
"test-unit": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec 'test/unit/**/*.js'", "test-unit": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec 'test/unit/**/*.js'",
"test-unit-mysql": "DIALECT=mysql npm run test-unit", "test-unit-mysql": "DIALECT=mysql npm run test-unit",
"test-unit-postgres": "DIALECT=postgres npm run test-unit", "test-unit-postgres": "DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "DIALECT=postgres-native npm run test-unit", "test-unit-postgres-native": "DIALECT=postgres-native npm run test-unit",
"test-unit-sqlite": "DIALECT=sqlite npm run test-unit", "test-unit-sqlite": "DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "DIALECT=mssql npm run test-unit", "test-unit-mssql": "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-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": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 15000 --reporter spec --grep \"$GREP\" 'test/integration/**/*.test.js'", "test-integration": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec --grep \"$GREP\" 'test/integration/**/*.test.js'",
"test-integration-mysql": "DIALECT=mysql npm run test-integration", "test-integration-mysql": "DIALECT=mysql npm run test-integration",
"test-integration-postgres": "DIALECT=postgres npm run test-integration", "test-integration-postgres": "DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "DIALECT=postgres-native npm run test-integration", "test-integration-postgres-native": "DIALECT=postgres-native npm run test-integration",
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
"test-mssql": "DIALECT=mssql npm test", "test-mssql": "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", "test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage", "cover": "rm -rf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage",
"cover-integration": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/integration/**/*.test.js' && mv coverage/lcov.info coverage/integration.info", "cover-integration": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 60000 --ui tdd 'test/integration/**/*.test.js' && mv coverage/lcov.info coverage/integration.info",
"cover-unit": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/unit/**/*.test.js'&& mv coverage/lcov.info coverage/unit.info", "cover-unit": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/unit/**/*.test.js'&& mv coverage/lcov.info coverage/unit.info",
"merge-coverage": "./node_modules/.bin/lcov-result-merger 'coverage/*.info' 'coverage/lcov.info'", "merge-coverage": "./node_modules/.bin/lcov-result-merger 'coverage/*.info' 'coverage/lcov.info'",
"coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", "coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
......
...@@ -15,7 +15,6 @@ var sortById = function(a, b) { ...@@ -15,7 +15,6 @@ var sortById = function(a, b) {
describe(Support.getTestDialectTeaser('Includes with schemas'), function() { describe(Support.getTestDialectTeaser('Includes with schemas'), function() {
describe('findAll', function() { describe('findAll', function() {
this.timeout(30000);
beforeEach(function() { beforeEach(function() {
var self = this; var self = this;
this.fixtureA = function() { this.fixtureA = function() {
......
...@@ -2605,7 +2605,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -2605,7 +2605,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
if (dialect !== 'sqlite' && current.dialect.supports.transactions) { if (dialect !== 'sqlite' && current.dialect.supports.transactions) {
it('supports multiple async transactions', function() { it('supports multiple async transactions', function() {
this.timeout(50000); this.timeout(90000);
var self = this; var self = this;
return Support.prepareTransactionTest(this.sequelize).bind({}).then(function(sequelize) { return Support.prepareTransactionTest(this.sequelize).bind({}).then(function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING }); var User = sequelize.define('User', { username: Sequelize.STRING });
......
...@@ -51,7 +51,6 @@ describe(Support.getTestDialectTeaser('Sequelize#transaction'), function() { ...@@ -51,7 +51,6 @@ describe(Support.getTestDialectTeaser('Sequelize#transaction'), function() {
if (Support.getTestDialect() !== 'sqlite') { if (Support.getTestDialect() !== 'sqlite') {
it('works for long running transactions', function() { it('works for long running transactions', function() {
this.timeout(10000);
return Support.prepareTransactionTest(this.sequelize).bind(this).then(function(sequelize) { return Support.prepareTransactionTest(this.sequelize).bind(this).then(function(sequelize) {
this.sequelize = sequelize; this.sequelize = sequelize;
......
...@@ -29,7 +29,8 @@ Sequelize.Promise.onPossiblyUnhandledRejection(function(e, promise) { ...@@ -29,7 +29,8 @@ Sequelize.Promise.onPossiblyUnhandledRejection(function(e, promise) {
Sequelize.Promise.longStackTraces(); Sequelize.Promise.longStackTraces();
// shim all Sequelize methods for testing for correct `options.logging` passing // shim all Sequelize methods for testing for correct `options.logging` passing
if (!process.env.COVERAGE && false) supportShim(Sequelize); // and no modification of `options` objects
if (!process.env.COVERAGE && process.env.SHIM) supportShim(Sequelize);
var Support = { var Support = {
Sequelize: Sequelize, Sequelize: Sequelize,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!