Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26648

Windows: ability to override global functions

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 7.5.0
    • Fix Version/s: Release 8.0.0
    • Component/s: Windows
    • Labels:
    • Story Points:
      3
    • Sprint:
      2018 Sprint 25

      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.

        Attachments

          Activity

            People

            • Assignee:
              kiguchi Kota Iguchi
              Reporter:
              kiguchi Kota Iguchi
              Reviewer:
              Christopher Williams
              Tester:
              Samir Mohammed
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code