npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

promises-es6-tests

v0.5.0

Published

Compliance test suite for ECMA-262 Promises

Downloads

559

Readme

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