I have a Titanium project which uses the CommonJS module style. However the code uses absolute paths so that when it builds the absolute path is sandboxed to the application directory.
var foo = require("/lib/module");
I want to run some tests on the command line and have jasmine-node working. However when a test executes a module the module will have the above absolute paths in their require statements.
Is there a way to isolate (maybe chroot) node to resolve absolute require paths to a specific directory? If so how?
-- RepositoryRoot/
|- app/
| \- Resources/
| |- app.js # Has require("/lib/module1.js")
| \- lib/
| |- module1.js # Has require("/lib/module2.js")
| \- module2.js
\- tests/
\- module1.spec.js # Has require("../app/Resources/lib/module1")
# Or require("/lib/module1")