GithubHelp home page GithubHelp logo

sebmarkbage / amdjs-tests Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amdjs/amdjs-tests

3.0 3.0 0.0 196 KB

AMD compliance tests

Home Page: https://groups.google.com/group/amd-implement

amdjs-tests's Introduction

AMD Tests

A set of Asynchronous Module Definition AMD compliance tests.

Right now the tests only run in the browser, but it will be possible to run them in Node and Rhino.

Configuration

An implementation needs to have the following two files in the impl directory:

  • AMD loader implementation
  • configure script

The configure script should define the following global variables:

  • config: a function that accepts configuration parameters. Similar to the RequireJS form of require({}).

  • go: a function that implements the top level, global function that starts loading of modules. Equivalent to the RequireJS global require([], function(){}) signature.

  • implemented: an object whose properties are the types of tests that the loader expects to pass.

Test Types

Each test type builds on the other: supporting later test types implies support for earlier test types.

basic

Very basic loading of named modules that have dependency arrays.

  • Support for define.amd to indicate an AMD loader.
  • Named modules.
  • Dependency arrays.
  • Circular dependency support via the "exports" and "require" dependency.
  • Test for the CommonJS "module" dependency.

require

Basic require() support, in accordance with the amdjs require API:

  • require(String)
  • require(Array, Function)
  • require.toUrl(String)

anon

Similar tests to basic, but using anonymous modules.

funcString

Tests parsing of definition functions via Function.prototype.toString() to get out dependencies. Used to support simplified CommonJS module wrapping:

    define(function (require) {
        var a = require('a');
        //Return the module definition.
        return {};
    });

namedWrapped

Similar to the funcString tests, but using named modules.

    define('some/module', function (require) {
        var a = require('a');
        //Return the module definition.
        return {};
    });

plugins

Support for loader plugins.

  • Calling the same plugin resource twice and getting the same value.
  • Testing a plugin that implements normalize().
  • Testing a plugin that uses load.fromText().

pluginDynamic

Support for loader plugins that use dynamic: true to indicate their resources should not be cached by the loader. Instead the loader should call the plugin's load() method for each instance of a dependency that can be loaded by the plugin.

Running the tests

Run the tests through a web server. The URL should look like the following:

http://127.0.0.1/amdjs-tests/tests/doh/runner.html?config=path/to/config.js&impl=path/to/loader.js

Where both the config and impl paths are paths that are inside the impl directory in this project.

To run the tests using the version of RequireJS in this repository:

http://127.0.0.1/amdjs-tests/tests/doh/runner.html?config=requirejs/config.js&impl=requirejs/require.js

Or, use the start.html page for a page of quick links to start testing.

amdjs-tests's People

Contributors

jrburke avatar rbackhouse avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.