{"library":"promises-es6-tests","title":"ECMAScript 6 Promises Test Suite","description":"The `promises-es6-tests` package provides a compliance test suite specifically designed for the **draft** ECMA-262 6th Edition (ES6, now ES2015) Promises specification. Released at version 0.5.0, it explicitly states that it should not be considered final or complete and does not supersede the Promises/A+ test suite, advising users to run both. The package enables testing of Promise implementations in both Node.js and browser environments by requiring a minimal adapter interface, an extension of the Promises/A+ adapter. Due to its focus on a draft specification that was finalized as ES2015 in June 2015, and its last release being version 0.5.0, this package is effectively outdated and provides checks against an early, non-final version of the standard rather than the stable ES2015 Promises. Its utility for modern Promise implementations is therefore very limited, as the specification it targets has evolved significantly.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install promises-es6-tests"],"cli":null},"imports":["import promisesES6Tests from 'promises-es6-tests';","const promisesES6Tests = require('promises-es6-tests');","promises-es6-tests test_adapter.js","<script src=\"node_modules/promises-es6-tests/bundle/promises-es6-tests.js\"></script>\n// Global `promisesES6Tests` becomes available"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import promisesES6Tests from 'promises-es6-tests';\n\n// Create a mock adapter that mimics a Promise library's interface\n// In a real scenario, this would import your actual Promise implementation\nconst adapter = {\n  // `Deferred` and `resolved`, `rejected` from Promises/A+ spec\n  // For ES6 tests, we primarily need the global Promise object setup/teardown\n  // and access to the Promise constructor being tested.\n  \n  // Example of a minimal adapter for a native Promise implementation\n  // For a polyfill, these would modify `globalScope`.\n  defineGlobalPromise: function (globalScope) {\n    globalScope.Promise = Promise; // Use native Promise for testing\n    globalScope.assert = require('assert'); // Node.js assert for tests\n  },\n  removeGlobalPromise: function (globalScope) {\n    delete globalScope.Promise;\n    delete globalScope.assert;\n  },\n  // The `resolve` and `reject` methods are from the Promises/A+ adapter spec\n  // and might not be directly used by all ES6 tests, but are part of the expected interface.\n  resolved: Promise.resolve.bind(Promise),\n  rejected: Promise.reject.bind(Promise)\n};\n\nconsole.log('Running promises-es6-tests...');\npromisesES6Tests(adapter, function (err) {\n  if (err) {\n    console.error(`Promises ES6 tests failed with ${err} failures.`);\n    process.exit(err);\n  } else {\n    console.log('Promises ES6 tests passed successfully.');\n    process.exit(0);\n  }\n});\n","lang":"javascript","description":"This quickstart demonstrates how to programmatically run the `promises-es6-tests` suite against a minimal adapter for a native Promise implementation in Node.js, reporting the number of test failures.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}