[TIMOB-26648] Windows: ability to override global functions
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-12-13T15:17:08.000+0000 |
| Affected Version/s | Release 7.5.0 |
| Fix Version/s | Release 8.0.0 |
| Components | Windows |
| Labels | parity |
| Reporter | Kota Iguchi |
| Assignee | Kota Iguchi |
| Created | 2018-12-13T11:22:20.000+0000 |
| Updated | 2019-01-03T12:26:28.000+0000 |
Description
Relates to https://github.com/appcelerator/HAL/pull/86 , https://github.com/appcelerator/titanium-mobile-mocha-suite/blob/master/Resources/timers.test.js#L170-L176 and https://github.com/appcelerator/titanium_mobile/blob/master/common/Resources/ti.internal/extensions/binding.js
We already modified this behavior on iOS to allow to override global functions like
setTimeout, which is typical of an environment like Node and is assumed by some of the popular JS testing frameworks.
I also ran into issues in overriding the standard require function in an effort to introduce cross-platform JS implementations of node-compatible "core" modules.
iOS PR: appcelerator/titanium_mobile#10155
unit tests we're skipping on Windows due to this
var originalRequire = global.require;
global.require = function (moduleId) {
Ti.API.info('Overridden require');
return originalRequire(moduleId);
}
require('require_test');
Expected: Overridden require should be shown before requiring files.
https://github.com/appcelerator/titanium_mobile_windows/pull/1334
Closing ticket. Fix verified in SDK version
8.0.0.v20190102142454.Is shown before the module is required. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile_windows/pull/1334 *Test Environment*Operating System Name = Microsoft Windows 10 Pro Version = 10.0.17134 Architecture = 64bit # CPUs = 4 Memory = 32.0GB Node.js Node.js Version = 8.9.1 npm Version = 5.5.1 Appcelerator CLI Installer = 4.2.13 Core Package = 7.0.9-3 Titanium CLI CLI Version = 5.1.1 node-appc Version = 0.2.44