Traverses up the directory tree and returns the first module found
Useful in tests so you don't have to require the package you're testing via relative paths.
Starts directory traversal from
process.cwd() so this should really only be used in tests or CLI apps.
npm install --save this
Or if using for tests you'll probably want:
npm install --save-dev this
this the same way you would require the root module with a relative path.
e.g instead of:
;;// and then in sub folders;
You can now do:
;;// and then in sub folders it's still just:;
e.g without import transpilation:
const test = ;const myPackage = ;
MIT © Luke Childs