Giter VIP home page Giter VIP logo

amdjs-tests's People

Contributors

erik168 avatar jakobo avatar jrburke avatar rbackhouse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amdjs-tests's Issues

relativeModuleId: Incorrect test.

In the test relativeModuleId the assertion t.is("util", array.utilName) should be t.is("impl/util", array.utilName).

Original Test:

config({
    paths: {
        "array": "impl/array"
    }
});

go(["require", "array"], function(require, array) {
        doh.register(
            "relativeModuleId",
            [
                function relativeModuleId(t){
                    t.is("impl/array", array.name);
                    t.is("util", array.utilName);
                }
            ]
        );

        doh.run();
    }
);

The array module from impl/array.js:

define(['./util'], function (util) {
    return {
        name: 'impl/array',
        utilName: util.name
    };
});

Note that the array module has a ./util dependency relative to the current module. The current module would in fact be impl/array, yielding a path of impl/, causing ./util to be resolved to impl/util.

The relativeModuleId test incorrectly assumes that the tests/anon/util.js file is loaded.

If this is not a bug but in fact implemented this way by design I would like to suggest changing to follow the above scenario. Following the above scenario will result in predictable relative module loading behaviour.

Side Effect (If implementation remains the same)

// This would cause our `impl/array.js` to attempt to load `arrays/are/so/great/util.js`.
config({
    paths: {
        "arrays/are/so/great": "impl/array"
    }
});

go(["require", "arrays/are/so/great"], function(require, array) {
        doh.register(
            "relativeModuleId",
            [
                function relativeModuleId(t){
                    t.is("impl/array", array.name);
                    t.is("util", array.utilName);
                }
            ]
        );

        doh.run();
    }
);

Some of the test files reference a global "require"

There are a couple of test files that don't specify require as a dependency and thus attempt to use a global one. If a global require is not provided by the loader tests that use these files fail with a reference error.

The 2 files in question are :

https://github.com/amdjs/amdjs-tests/blob/master/tests/anon/funcThree.js
https://github.com/amdjs/amdjs-tests/blob/master/tests/basic/funcThree.js

If I add require as a dependency to them the tests pass in my loader which does not provide a global require.

Ambiguous assertion in anon_relative/_test.js.

In the following assertion, the message claims that "util" should resolve to impl/util. However, the test checks 'util' === array.utilName.

amdJS.assert('util' === array.utilName, 'anon_relative: resolved "util" to impl/util');

No tests exist for named modules

A loader implementation not supporting named modules will pass all tests for non-optional features. Some new tests along these lines should cover it:

define("foo", ["bar"], function(bar) {
    amdJS.assert("bar" === bar.name, "named_simple: multiple modules");
});

define("bar", function() {
    return { name: "bar" };
});

If there's any interest in this, I can make a pull request later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.