This package provides the official compliance test suite for the Promises/A+ specification, currently at version 2.1.2. It is designed to verify that a promise implementation correctly adheres to the `then()` method behavior defined in the Promises/A+ specification. The suite can be run in both Node.js and browser environments, requiring a minimal adapter interface from the promise library under test. Key differentiators include its status as the authoritative test suite for the specification, allowing compliant libraries to display the Promises/A+ logo. Releases appear to be driven by specification updates and maintenance, with the last major update (v2.0.0) aligning with Promises/A+ v1.1. It ensures comprehensive test coverage for various promise states and operations, making it an essential tool for promise library authors.
npm install promises-aplus-testsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to programmatically run the Promises/A+ compliance test suite against a provided custom promise adapter, outputting results using Mocha's 'spec' reporter.
Update your promise adapter to use `resolved` and `resolve` instead of `fulfilled` and `fulfill` to align with Promises/A+ specification v1.1.
Ensure your adapter code includes robust error handling, wrapping any potentially throwing operations from your promise library in `try`/`catch` statements to prevent test failures.
If your promise library has factory methods for already-resolved or already-rejected promises, implement and export `resolved(value)` and `rejected(reason)` functions in your adapter.
If you are using an older version (prior to 2.0.4), ensure that no-value Mocha arguments are not the final argument, or update the package to version 2.0.4 or newer.
Ensure your adapter module (e.g., `module.exports = { deferred: ... }`) includes a correctly implemented `deferred` function that returns `{ promise, resolve, reject }`.Verify that the `deferred()` function in your adapter returns an object with `promise`, `resolve`, and `reject` properties, and that `resolve` and `reject` are indeed functions.
Review the detailed output from the test runner (Mocha) in your console to identify which specific Promises/A+ specification points failed and debug your promise library accordingly. The `err.failures` property will indicate the count of failed tests.