The problem
Latest CI builds do not cache CommonJS modules (or at least it seems they don't in some cases). That cause all kind of strange issue (one will be demonstrated in test case).
This commit causes this behavior:
https://github.com/appcelerator/titanium_mobile/commit/70a9f7984281b8e9ab9c8d73ec3afadc79778b8b
(before that commit, everything works fine)
Test case
// app.js
function runTest() {
var test1 = require('test/test1');
Ti.API.debug(test1.blabla.test);
}
runTest();
runTest();
// test/test1.js
Ti.API.info('Test 1 require');
var test2 = require('test/test2');
var myModule = {
blabla: {
test: test2.test + ' Yes, no?'
}
};
module.exports = myModule;
// test/test2.js
var test = 'Success!';
var objectToExport = {
test: test
};
module.exports = objectToExport;
Output:
06-18 13:21:42.790: I/TiAPI(1925): Test 1 require
06-18 13:21:42.800: D/TiAPI(1925): Success! Yes, no?
06-18 13:21:42.800: I/TiAPI(1925): Test 1 require
06-18 13:21:42.800: D/TiAPI(1925): undefined Yes, no?
Expected output
There should be only one "Test 1 require" console line and forth line should be identical to second one.
Btw, this works fine on iOS.
This ticket is duplicate of TIMOB-9662.
DUP issue.