{"id":12978,"library":"commonmark-test-suite","title":"CommonMark Test Suite Data","description":"The `commonmark-test-suite` package provides programmatic access to the official CommonMark Specification test suite data, enabling developers to verify their CommonMark parsers against a standardized set of examples. It aggregates and exposes test cases for various CommonMark spec versions, including the latest stable version (currently 0.31.2, released January 28, 2024). This package itself is at version 0.1.0, indicating it is a relatively new utility that serves as a structured, up-to-date data source for the evolving CommonMark specification. Its primary differentiator is pre-processing and organizing the raw spec test data into an easily consumable JavaScript format, eliminating the need for manual parsing of the spec documents. The release cadence of this package is generally aligned with updates to the CommonMark spec, ensuring that the test data remains current and comprehensive.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/fisker/commonmark-test-suite","tags":["javascript","typescript"],"install":[{"cmd":"npm install commonmark-test-suite","lang":"bash","label":"npm"},{"cmd":"yarn add commonmark-test-suite","lang":"bash","label":"yarn"},{"cmd":"pnpm add commonmark-test-suite","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package primarily uses ES Modules. The default export is an object containing test suites categorized by CommonMark spec version (e.g., `commonmarkTestSuite['0.30']`), including a `latest` property for the most recent version.","wrong":"const commonmarkTestSuite = require('commonmark-test-suite')","symbol":"commonmarkTestSuite","correct":"import commonmarkTestSuite from 'commonmark-test-suite'"},{"note":"TypeScript types are shipped with the package, allowing for type-safe access to the structure of the test suite data.","symbol":"CommonMarkTestSuite","correct":"import type { CommonMarkTestSuite } from 'commonmark-test-suite'"},{"note":"Individual properties like `latest` (or specific version numbers like `'0.30'`) can be destructured from the default export to access specific test suite objects directly.","symbol":"testCases","correct":"import { latest } from 'commonmark-test-suite'; const { testCases } = latest;"}],"quickstart":{"code":"import commonmarkTestSuite from 'commonmark-test-suite'\n\n// Access the latest CommonMark specification test suite\nconst latestSuite = commonmarkTestSuite.latest;\n\nconsole.log(`CommonMark Spec Version: ${latestSuite.version}`);\nconsole.log(`Release Date: ${latestSuite.date}`);\nconsole.log(`Number of Test Cases: ${latestSuite.testCases.length}`);\n\n// Log the first few test cases for inspection\nconsole.log('First 3 Test Cases:');\nlatestSuite.testCases.slice(0, 3).forEach((test, index) => {\n  console.log(`\\nExample ${test.example} (Section: ${test.section}):`);\n  console.log('Markdown Input:\\n```markdown\\n' + test.markdown + '```');\n  console.log('Expected HTML Output:\\n```html\\n' + test.html + '```');\n});\n\n// Access a specific legacy version's test suite\nconst legacySuite = commonmarkTestSuite['0.30'];\nif (legacySuite) {\n  console.log(`\\nLegacy Spec Version: ${legacySuite.version}`);\n  console.log(`Number of Legacy Test Cases: ${legacySuite.testCases.length}`);\n} else {\n  console.log(`\\nCommonMark spec 0.30 not found in the package.`);\n}\n","lang":"typescript","description":"This quickstart demonstrates how to import the `commonmark-test-suite` and access both the latest and specific legacy versions of the CommonMark test cases, logging their metadata and a few examples."},"warnings":[{"fix":"Always refer to `commonmarkTestSuite.latest.version` or `commonmarkTestSuite['<version_number>'].version` to identify the CommonMark spec version.","message":"The version of the `commonmark-test-suite` package (e.g., 0.1.0) is independent of the CommonMark specification version it contains (e.g., 0.31.2). Always check the `version` property of the accessed test suite object (e.g., `commonmarkTestSuite.latest.version`) to know which spec version you are working with.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure your development and production environments are running Node.js v14 or a more recent LTS version.","message":"This package requires Node.js v14 or higher due to its internal dependencies and build process. Using older Node.js versions may lead to runtime errors or installation failures.","severity":"breaking","affected_versions":"<0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change `const commonmarkTestSuite = require('commonmark-test-suite')` to `import commonmarkTestSuite from 'commonmark-test-suite'` in your JavaScript or TypeScript files.","cause":"Attempting to use `require()` to import `commonmark-test-suite`, which is an ES Module package.","error":"ERR_REQUIRE_ESM: Must use import to load ES Module"},{"fix":"Verify the available spec versions by logging `Object.keys(commonmarkTestSuite)` or ensure you are using a valid version string, typically found in the `latest` object or the package's documentation (e.g., `'0.31.2'`, `'0.30'`).","cause":"Attempting to access a CommonMark spec version (e.g., `commonmarkTestSuite['unknown']`) that does not exist or is not exposed by the package.","error":"TypeError: Cannot read properties of undefined (reading 'testCases') or similar property access errors."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}