felixmosh / knex-mock-client

A mock client for knex which allows you to write unit tests with DB interactions
MIT License
53 stars 8 forks source link

Support for Knex 3.x #48

Closed jvesala closed 1 year ago

jvesala commented 1 year ago

Hello!

The current version supports Knex 2.x versions only. Are there any plans to support 3.x as well?

Best,

Jussi

felixmosh commented 1 year ago

Did you tried it with knex v3? It should work... If no, can you share the error...

felixmosh commented 1 year ago

Did you tried it? Is it failed? What do you get?

jvesala commented 1 year ago

The following line in package.json is causing problems with npm i.

"peerDependencies": { "knex": "^2.0.0" },

I didn't try any magic to bypass that and see if it would work for real.

felixmosh commented 1 year ago

Can you check if it solved for you in v2.0.1?

brainsiq commented 1 year ago

I've just tried this and it seems to work fine with knex 3 with a fairly basic test. Just had to tell npm to ignore the restriction on the peer dependency using npm i -D knex-mock-client --force so would be ideal to just update the peer dependency to allow 2 or 3...

"peerDependencies": {
"knex": "^2.0.0 || ^3.0.0"
},

Or if you want to be less restrictive it could just be >=2.0

felixmosh commented 1 year ago

@brainsiq thank you for your input, this is exactly what i've did in v2.0.1 :]

Closing this issue.

jvesala commented 1 year ago

Thank you for your fast feedback. Version 2.0.1 seems to work nicely with Knex 3.x series. 🙇