Dependency injection is a simple concept to implement and does not require any third-party tools. On the other hand, monkey patching is hard to implement and you'd normally use babel-plugin-rewire or a similar library. This means that our test would now have to depend on the babel-plugin-rewire package.
This can become an issue if babel-plugin-rewire becomes unmaintained, or if maintenance is slow. At the time of writing this book, the babel-plugin-rewire plugin still lacks support for Babel 7. If a developer is using the babel-plugin-rewire plugin, he/she won't be able to upgrade their Babel version, and for developers who are already using Babel 7, they won't be able to monkey patch until support is implemented. ...