{"id":14120,"library":"test262-parser-runner","title":"ECMAScript Parser Test Runner","description":"The `test262-parser-runner` is a utility designed to execute the official ECMAScript Test Suite (Test262) against any given JavaScript parser. Currently at version 0.5.0, it targets early-stage development and parser validation. While it doesn't specify a fixed release cadence, its versioning suggests ongoing development with potentially frequent updates. A key differentiator is its robust mechanism for managing test outcomes: it supports a `skip` filter function to completely ignore tests (e.g., for unimplemented features) and a `whitelist` array for tests expected to fail temporarily but eventually pass. This allows parser developers to precisely control which tests contribute to their pass/fail metrics. The project distinguishes itself by building upon a previously MIT-licensed test runner while distributing its own code under the GNU Affero General Public License v3.0, a significant detail for downstream users.","status":"active","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/adrianheine/test262-parser-runner","tags":["javascript","test262"],"install":[{"cmd":"npm install test262-parser-runner","lang":"bash","label":"npm"},{"cmd":"yarn add test262-parser-runner","lang":"bash","label":"yarn"},{"cmd":"pnpm add test262-parser-runner","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Commonly used as the parser target in examples and real-world usage.","package":"acorn","optional":true},{"reason":"Provides the actual ECMAScript test suite files. While a bundled version is default, direct dependency allows for control.","package":"test262","optional":true}],"imports":[{"note":"The `require` example from the README suggests a default export for the main `run` function.","wrong":"const { run } = require('test262-parser-runner');","symbol":"run","correct":"import run from 'test262-parser-runner';"},{"note":"CommonJS `require` is explicitly shown in the official usage examples.","wrong":"import { run } from 'test262-parser-runner';","symbol":"run","correct":"const run = require('test262-parser-runner');"},{"note":"`acorn` is commonly imported via named exports in modern JavaScript, though CommonJS `.parse` also works.","wrong":"const parse = require('acorn').parse;","symbol":"parse","correct":"import { parse } from 'acorn';"}],"quickstart":{"code":"import run from 'test262-parser-runner';\nimport { parse } from 'acorn';\nimport path from 'path';\n\n// Ensure you have test262 cloned locally, e.g., git clone https://github.com/tc39/test262\nconst test262Dir = process.env.TEST262_DIR ?? path.resolve(__dirname, 'path/to/your/test262/repo');\n\nif (!test262Dir) {\n  console.error('Please set the TEST262_DIR environment variable or update the quickstart code with the path to your cloned test262 repository.');\n  process.exit(1);\n}\n\nrun(\n  (content, { sourceType }) => parse(content, { sourceType, ecmaVersion: 2020 }), // Assuming a modern ecmaVersion\n  {\n    skip: test => false, // No tests are skipped by default\n    whitelist: [\n      // Example: 'test/language/expressions/arrow-function/syntax-error-no-newline.js'\n    ], \n    testsDirectory: test262Dir, // Specify the path to your Test262 clone\n    // Other options like 'limit', 'reporter' can be added here\n  }\n).then(results => {\n  console.log('Test run complete:', results);\n  if (results.failures.length > 0) {\n    console.error(`Found ${results.failures.length} failures.`);\n    // Optionally process or log detailed failures\n  } else {\n    console.log('All whitelisted tests passed successfully.');\n  }\n}).catch(error => {\n  console.error('An error occurred during test run:', error);\n});","lang":"typescript","description":"This quickstart demonstrates how to run the Test262 suite against the Acorn parser, configuring custom skip and whitelist rules, and specifying the Test262 repository path."},"warnings":[{"fix":"Review the AGPLv3.0 license terms carefully to understand your obligations before integrating into your project, especially if distributing commercially or as part of a proprietary system.","message":"The `test262-parser-runner` package itself is licensed under the GNU Affero General Public License v3.0, despite being based on an MIT-licensed component. This has significant implications for derivative works and distribution.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pin exact versions (e.g., `\"test262-parser-runner\": \"0.5.0\"`) or use a tilde range (`~0.5.0`) to avoid unexpected updates. Regularly check the project's changelog for breaking changes.","message":"The package version 0.5.0 indicates it is still in an early development stage (pre-1.0.0). While API stability is generally a goal, breaking changes might occur in minor versions before a stable 1.0.0 release.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always provide an explicit `testsDirectory` option pointing to a fresh, cloned copy of the official `tc39/test262` GitHub repository to ensure you are testing against the most current suite.","message":"By default, `test262-parser-runner` might use a bundled version of the Test262 suite if `testsDirectory` is not specified. This bundled version may be outdated, leading to tests that don't reflect the latest ECMAScript specification.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.5.0':30 'affero':132 'allow':97 'array':86 'build':115 'cadenc':48 'code':128 'complet':76 'contribut':105 'control':102 'current':27 'design':13 'detail':139 'develop':36,53,99 'differenti':60 'distinguish':112 'distribut':125 'doesn':42 'downstream':141 'e.g':79 'earli':34 'early-stag':33 'ecmascript':1,18 'eventu':94 'execut':15 'expect':89 'fail':91 'featur':82 'filter':73 'fix':46 'frequent':56 'function':74 'general':133 'given':24 'gnu':131 'ignor':77 'javascript':25,143 'key':59 'licens':121,135 'manag':66 'mechan':64 'metric':109 'mit':120 'mit-licens':119 'offici':17 'ongo':52 'outcom':68 'parser':2,8,26,38,98 'pass':95 'pass/fail':108 'potenti':55 'precis':101 'previous':118 'project':111 'public':134 'releas':47 'robust':63 'runner':4,9,123 'signific':138 'skip':72 'specifi':44 'stage':35 'suggest':51 'suit':20 'support':70 'target':32 'temporarili':92 'test':3,19,67,78,88,104,122 'test262':7,21,144 'test262-parser-runner':6 'unimpl':81 'updat':57 'upon':116 'user':142 'util':12 'v3.0':136 'valid':39 'version':29,50 'whitelist':85","created_at":"2026-04-20T01:58:01.442427+00:00","updated_at":"2026-04-20T01:58:01.442427+00:00","problems":[{"fix":"Ensure the path provided to `testsDirectory` is correct and accessible. Clone the `tc39/test262` repository locally and point the option to its root directory.","cause":"The `testsDirectory` option points to a non-existent or inaccessible path for the Test262 repository.","error":"Error: ENOENT: no such file or directory, stat '/path/to/test262'"},{"fix":"Verify that your parser (e.g., `acorn.parse`) is correctly imported and that the wrapper function passed to `run` correctly calls it with `content` and `sourceType`.","cause":"The parser function provided to `run` is either undefined or not a callable function, or its arguments are not being destructured correctly.","error":"TypeError: parse is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"test262-parser-runner","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/adrianheine/test262-parser-runner","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/test262-parser-runner","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}