Registry / testing / commonmark-test-suite

commonmark-test-suite

JSON →
library0.1.0jsnpmunverified

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.

npm install commonmark-test-suite
INSTALL
IMPORT
SIG · COMMONMARK-TEST-SU
C
commonmark-test-suite
testingjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

commonmarkTestSuite
import commonmarkTestSuite from 'commonmark-test-suite'
const commonmarkTestSuite = require('commonmark-test-suite')
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.
CommonMarkTestSuite
import type { CommonMarkTestSuite } from 'commonmark-test-suite'
TypeScript types are shipped with the package, allowing for type-safe access to the structure of the test suite data.
testCases
import { latest } from 'commonmark-test-suite'; const { testCases } = latest;
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.

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.

import commonmarkTestSuite from 'commonmark-test-suite' // Access the latest CommonMark specification test suite const latestSuite = commonmarkTestSuite.latest; console.log(`CommonMark Spec Version: ${latestSuite.version}`); console.log(`Release Date: ${latestSuite.date}`); console.log(`Number of Test Cases: ${latestSuite.testCases.length}`); // Log the first few test cases for inspection console.log('First 3 Test Cases:'); latestSuite.testCases.slice(0, 3).forEach((test, index) => { console.log(`\nExample ${test.example} (Section: ${test.section}):`); console.log('Markdown Input:\n```markdown\n' + test.markdown + '```'); console.log('Expected HTML Output:\n```html\n' + test.html + '```'); }); // Access a specific legacy version's test suite const legacySuite = commonmarkTestSuite['0.30']; if (legacySuite) { console.log(`\nLegacy Spec Version: ${legacySuite.version}`); console.log(`Number of Legacy Test Cases: ${legacySuite.testCases.length}`); } else { console.log(`\nCommonMark spec 0.30 not found in the package.`); }
Debug
Known issues
gotchaThe 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.
fix
Always refer to `commonmarkTestSuite.latest.version` or `commonmarkTestSuite['<version_number>'].version` to identify the CommonMark spec version.
affects: >=0.0.1
breakingThis 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.
fix
Ensure your development and production environments are running Node.js v14 or a more recent LTS version.
affects: <0.1.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: Must use import to load ES Module
Attempting to use `require()` to import `commonmark-test-suite`, which is an ES Module package.
fix
Change `const commonmarkTestSuite = require('commonmark-test-suite')` to `import commonmarkTestSuite from 'commonmark-test-suite'` in your JavaScript or TypeScript files.
TypeError: Cannot read properties of undefined (reading 'testCases') or similar property access errors.
Attempting to access a CommonMark spec version (e.g., `commonmarkTestSuite['unknown']`) that does not exist or is not exposed by the package.
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'`).
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
2
Resources
commonmark-test-suite — npm install commonmark-test-suite · libregistry