These examples are fairly trivial, and don't really illustrate what DI/IoC frameworks tend to do, which imho is just as well... I much prefer the simple require/import statements that CJS/ES6 offer... as for testing, there's proxyquire.
For the most part IoC frameworks only offer indirection and difficulty in tracking down issues, when handling enhancements on a project that is new to you, or when it's fairly large with a lot of developers, and nobody understands the whole anymore.
I used to argue with the graybeard types when I was started with regards to enterprise patterns... now that I've kind of reached graybeard status, I'm far more inclined to use the simplest solution possible for as long as possible.