jbrumwell / mock-knex

A mock knex adapter for simulating a database during testing
MIT License
239 stars 71 forks source link

change port #74

Closed nbalduzzi closed 6 years ago

nbalduzzi commented 6 years ago

Hi,

i have an issue that if i have running a docker mysql image in port 3307 for example, when i mock the connection doing:

const knex = require('knex') const mock = require('mock-knex') const db = knex({ client: 'mysql' }) mock.mock(db)

always connect to 3306, and if i change the connection like:

const db = knex({ client: 'mysql', connection: { port: 3307 } })

i have the same result when i run the test inside docker. By default always try to connect to port 3306 and if i have a phisical mysql installed to other systems retrieves an error like connection refused because the phiscial mysql have another users that i dont need inside docker msyql image.

Someone maybe know how solve it?

thanks!

jbrumwell commented 6 years ago

If this fails;

const db = knex({ client: 'mysql', connection: { port: 3307 } })

then it would be a knex issue, if it only fails with a mocked connection then it would be our issue.