Project: titanium
Issue TIMOB-23512: Windows: relative require() from sub-directory fails
While writing the mocha test suite, I happened to uncover a bug in Windows require() without actually trying to test it! Inside the test app, we have: {code} - Resources |-- utilities | |-- assertions.js | |-- utilities.js |-- app.js |-- ti.accelerometer.test.js {code} {{/utilities/assertions.js}} has a {{require('./utilities');}} which is failing to resolve. I believe we're not holding onto the path/dirname of a given module to use as the basis for resolving require calls inside it. {code} 14:22:31 -- Start application log ----------------------------------------------------- 14:22:31 [ERROR] :  Application Error: { 14:22:31 [ERROR] :   "line": 2, 14:22:31 [ERROR] :   "column": 10, 14:22:31 [ERROR] :   "message": "Error while require(/app) Error while require(./ti.accelerometer.test) Error while require(./utilities/assertions) Could not load module ./utilities", 14:22:31 [ERROR] :   "native_stack": [ 14:22:31 [ERROR] :   "JSExportClass::CallNamedFunction" 14:22:31 [ERROR] :   ] 14:22:31 [ERROR] :  } {code}
Story points: 8