toplevel

Toplevel lets you require node modules relative to the toplevelevel of your code

Toplevel is a super simple node module that wraps the built-in require() and lets you require your code relative to a top level directory rather than relative to the current file.

Create an empty Top file in the top level directory of your code.

$ touch Toplevel
$ tree -I node_modules .
.
├── app.js
├── lib
│   └── example.js
├── package.json
├── test
│   └── example_test.js
└── Top

Now any code in subdirectories like lib or test can use topl to require modules relative to the Top file.

test/example_tests.js:

var requireFromTop = require('toplevel')(__dirname)
   ,example = requireFromTop('lib/example');
...