GithubHelp home page GithubHelp logo

kryndex / promises-es6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from promises-es6/promises-es6

0.0 2.0 0.0 227 KB

Test suite for compliance with ECMA-262 Promise (6th Edition, Draft Specification)

Makefile 1.60% JavaScript 98.40%

promises-es6's Introduction

ECMAScript 6 Promises Test Suite

This suite tests compliance of a promise implementation with the ECMA-262 6th Edition Draft specification.

Since ECMA-262 is still a draft specification, this test suite should not be regarded as final or complete. This test suite is intended to be contributed to the ECMA test262 project for ES6; however, until it is incorporated into test262, it should NOT be regarded as a definitive claim of what the ES6 standard requires.

These tests also do NOT supersede the promises-aplus tests. These tests are orthogonal to promises-aplus/promises-tests. You should run both sets of tests.

How To Run

The tests run in a Node.js environment or in the browser.

Adapters

In order to test a promise library, you must expose a minimal adapter interface. This is an extension of the Promises/A+ test adapter, with the following additional exports:

  • defineGlobalPromise(globalScope): ensures that globalScope.Promise is the implementation to be tested and ensures that globalScope.assert behaves like the node assert library
  • removeGlobalPromise(globalScope): removes Promise from globalScope

When a native (browser or node) implementation of Promises is being tested, these functions can have empty bodies (it is fine for these to be no-ops).

When a polyfill or other Javascript implementation of Promises is being tested, these functions should modify the passed-in globalScope object, not the global object.

From the CLI

This package can be invoked with a command-line interface, similarly to promises-aplus-tests.

As a globally installed package:

 $ npm install -g promises-es6-tests
 $ promises-es6-tests test_adapter

As a dependent package:

{
    "devDependencies": {
        "promises-aplus-tests": "*",
        "promises-es6-tests": "*"
    },
    "scripts": {
        "test": "run-tests && promises-aplus-tests test_adapter && promises-es6-tests test_adapter"
    }
}

The CLI takes as its first argument the name of the adapter file, relative to the current working directory. It passes through any subsequent options to Mocha.

Programmatically

The main export of this package is a function that allows you to run the tests against an adapter:

var promisesES6Tests = require("promises-es6-tests");

promisesES6Tests(adapter, function (err) {
    // tests complete; output to console; `err` is number of failures
});

In The Browser

The tests are collected into a single file, bundle/promises-es6-tests.

{
    "devDependencies": {
        "promises-es6-tests": "*"
    },
}
   <!-- set up mocha and assert -->
   <script src="node_modules/promises-es6-tests/bundle/promises-es6-tests.js></script>

Structure of Tests

promises-es6's People

Contributors

cscott avatar smikes avatar

Watchers

 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.