Reputation: 6449
Have a look at Dredd, for example, it makes the library Hooks available when you are running a script with the dredd
command.
Command line
$ dredd [...] --hookfiles=./hooks.js
hooks.js
const hooks = require('hooks');
...
How does it work?
Upvotes: 1
Views: 417
Reputation: 8796
I'm the maintainer of Dredd. In Dredd's case it's implemented using the proxyquire library. I think rewire does similar things.
Upvotes: 1
Reputation: 1639
Check out npm link
, which can be used to "link" together local modules as if they were a dependency visible in the node_modules
directory. This can be very useful when splitting off code into a library. I'm not exactly sure what dredd
is doing, but it is likely based off of the npm link
paradigm.
Upvotes: 0