Apache Cordova
  1. Apache Cordova
  2. CB-267

add test cases for require() and friends in codova-js

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: CordovaJS
    • Labels:
      None

      Description

      We should add some test cases to cordova-js to test the require() and friends bits.

        Activity

        Hide
        Patrick Mueller added a comment -

        There are test cases for CommonJS bits that we should probably support, here:

        https://github.com/commonjs/commonjs/tree/master/tests

        The license for the test cases is here:

        https://github.com/commonjs/commonjs/blob/master/docs/license.html.markdown

        Proposal is to pull those into cordova-js in a new directory 'cjs-tests' under the 'thirdparty' directory.

        We'll need to update the LICENSE file to indicate the licensing of that (and add the jasmine bits as a "drive by" fix).

        To run the test cases, we'll need a separate loader/runner, as the tests have a distinct set of runtime requirements. I've already built and used a loader/runner for this with modjewel, so I'll pull those in, I guess under 'test' as 'cjs-tests'. Not sure if it's appropriate or desired to have these tests folded into some uber-test suite or not, given the different runtime set up, and the fact that these tests shouldn't need to be run all that often anyway - they are generally orthogonal to the existing cordova test cases.
        In order to run the

        Show
        Patrick Mueller added a comment - There are test cases for CommonJS bits that we should probably support, here: https://github.com/commonjs/commonjs/tree/master/tests The license for the test cases is here: https://github.com/commonjs/commonjs/blob/master/docs/license.html.markdown Proposal is to pull those into cordova-js in a new directory ' cjs-tests ' under the ' thirdparty ' directory. We'll need to update the LICENSE file to indicate the licensing of that (and add the jasmine bits as a "drive by" fix). To run the test cases, we'll need a separate loader/runner, as the tests have a distinct set of runtime requirements. I've already built and used a loader/runner for this with modjewel, so I'll pull those in, I guess under ' test ' as ' cjs-tests '. Not sure if it's appropriate or desired to have these tests folded into some uber-test suite or not, given the different runtime set up, and the fact that these tests shouldn't need to be run all that often anyway - they are generally orthogonal to the existing cordova test cases. In order to run the
        Hide
        Patrick Mueller added a comment -

        I suppose I should mention: I fully expect these tests to fail with our current version of require(). That's to be expected.

        Once the test cases are integrated and basically running - and failing - I'll open another bug to fix the issues in our version of require().

        Show
        Patrick Mueller added a comment - I suppose I should mention: I fully expect these tests to fail with our current version of require() . That's to be expected. Once the test cases are integrated and basically running - and failing - I'll open another bug to fix the issues in our version of require() .
        Hide
        Patrick Mueller added a comment -

        output of running the tests on the current require()

        Show
        Patrick Mueller added a comment - output of running the tests on the current require()
        Hide
        Patrick Mueller added a comment -

        pushed the following commit to cordova-js for this fix:

        https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit;h=d7341998e657598a8419aa421d84e5bebbb26494

        I was unable to run 'jake test', due to some kind of runtime issue with my system (I guess).

        Show
        Patrick Mueller added a comment - pushed the following commit to cordova-js for this fix: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commit;h=d7341998e657598a8419aa421d84e5bebbb26494 I was unable to run ' jake test ', due to some kind of runtime issue with my system (I guess).

          People

          • Assignee:
            Patrick Mueller
            Reporter:
            Patrick Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development