mantoni / mochify.js

☕️ TDD with Browserify, Mocha, Headless Chrome and WebDriver
MIT License
346 stars 57 forks source link

Allow driver option to be a module on API level #273

Closed m90 closed 2 years ago

m90 commented 2 years ago

Consumers of the API module might want to pass in a custom (?) driver module instead of having to rely on Mochify to do the resolution:

mochify({
  driver: require('./my-driver-thing'),
  ...other
})

While this might look simple in the above snippet, there is one thing I am not sure about: does this mean that you're using a .js config file, you could require the driver in there and pass it down? In case yes, do we want that or should config stay rather dumb?

mantoni commented 2 years ago

Thank you for doing all the work on the rewrite lately 🙏.

Not sure about the .js config idea. Let's worry about that once someone runs into it.

There's quite a bit of logic in the module resolution code now. Can you add some unit tests?

m90 commented 2 years ago

There's quite a bit of logic in the module resolution code now. Can you add some unit tests?

Makes sense, I moved the function into its own module and added unit tests.