rochejul / sequelize-mocking

Sequelize extension to deal with data-mocking for testing
MIT License
63 stars 26 forks source link

locked down sequelize version breaks query generator #9

Closed trashhalo closed 7 years ago

trashhalo commented 7 years ago

Squelize's query generator uses several instanceof checks. Because you are specificfying a specific version of sequelize anyone depending on your library that isnt using that exact version of sequelize is getting broken sql for joins.

This is due to the fact npm will give your library a different sequelize and so when the query builder asks if the association is an instanceof BelongsTo it gets back false becauses its a different BelongsTo.

I recommend adding a ^ to the front of the version specifier so anyone using a 3.X.X will not have this problem.

rochejul commented 7 years ago

Hi

I used too a shrinkwrap file (which is exposed) to freeze my dependencies, because this is a good practice to avoid as much as possible the wildcard version token (to avoid side effects)

I could update my sequelize version, but that means I have to check first if I don't find a side effect.

And maybe offers an option to specify the current sequelize object instead.

Regards

rochejul commented 7 years ago

Or maybe declare instead the sequelize as devDependency: since "peerDependencies" is not anymore available since NPM 3.X, it seems now the right

Here an example of a famous gulp plugin which declare into the devDependencies the gulp version. So it let you to have the expected gulp version: https://github.com/hparra/gulp-rename/blob/master/package.json

Regards

trashhalo commented 7 years ago

And maybe offers an option to specify the current sequelize object instead.

This makes sense too. Or update the readme to say if you aren't using my exact version of sequelize this library won't work.