rochejul / sequelize-mocking

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

lodash library not imported anymore in Sequelize new versions #17

Closed SuperToma closed 6 years ago

SuperToma commented 6 years ago

With sequelize 4.8.0 (and greater) : Sequelize.Utils._ is undefined

rochejul commented 6 years ago

Hi If so, you should too move lodash from devDependencies to dependencies into the package.json

Many thanks for your pull request

Regards

SuperToma commented 6 years ago

Lodash can't be a primary package with node 4.0.0 :( Error: Cannot find module 'lodash'

(no problem with node 6.x.x)

Do you need backward compatibility with node 4 ?

rochejul commented 6 years ago

Hi @SuperToma Can you regenerate the npm-shrinkwrap.json ? You can use the following command:

npm run generate-shrinkwrap

Otherwise, try to remove this file.

I very would like to have the same "constraints" as Sequelize (which is based on node >= 4).

If this does not work again, maybe we should look to replace the use of:

Otherwise, we can try to use instead underscore

Regards

SuperToma commented 6 years ago

I fixed it ! I ran npm run generate-shrinkwrap Can you config npm-shrinkwrap.json ?

rochejul commented 6 years ago

Hi @SuperToma Sadly, the only thing we could specify when we generate this file is: should we include dependencies AND devDependencies, or only dependencies.

What did you expect around this configuration ?

I try to check your pull request tonight if possible)

Regards

rochejul commented 6 years ago

I could change it, but prefer the use of _.noop instead create onto the SequelizeMocking service a new method for that

Many thanks regards

SuperToma commented 6 years ago

Oups,

1/ For the file "npm-shrinkwrap.json" I wanted to say : "Can you check the file npm-shrinkwrap.json" (instead of "can you config") because the the URLs changed in the file.

2/ For the noop function the problem is :

Si je ne me trompe pas tu es français, ce serait peut-être plus simple pour communiquer :)

rochejul commented 6 years ago

The shrinkwrap file sounds good

Sure the _.noop is usefull for test. And as a node dependency, it will be available for testing. So into the test, we could do a require('lodash')

If you want I could apply the changes and check if it works

And yes I am french ☺

SuperToma commented 6 years ago

Lodash is still loaded as devDependency for tests inside /tests/ folder. but _.noop was used in lib/sequelize-mocking.js that is build for production.

If you can apply the changes it would be wonderful :) regards,

rochejul commented 6 years ago

Ok that means to declare it only as dependency.

I will create a ticket

Regards

rochejul commented 6 years ago

Related to #18 Many thanks for your contribution

SuperToma commented 6 years ago

Wonderful, Thank you ! It works with Sequelize 4.14.0.