Registry / testing / yaml-test-suite

yaml-test-suite

JSON →
library0.1.0jsnpmunverified

The `yaml-test-suite` package provides a JavaScript representation of the official YAML test suite data, as defined by the YAML community. It encapsulates a comprehensive collection of YAML test cases, including their original filenames, descriptive names, source URLs, associated tags, and individual test scenarios (with YAML input and expected JSON output). Currently at version 0.1.0, this library is a relatively stable data source, primarily seeing updates when the underlying YAML test suite itself evolves or when minor structural enhancements are added (like the `id` field in 0.1.0). Its primary differentiation is offering this suite as a directly consumable JavaScript array, eliminating the need for developers to parse raw YAML test files manually, making it ideal for testing YAML parsers, linters, or other YAML-related tools within JavaScript or TypeScript environments.

npm install yaml-test-suite
INSTALL
IMPORT
SIG · YAML-TEST-SUITE
Y
yaml-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.

default
import yamlTestSuite from 'yaml-test-suite'
import { yamlTestSuite } from 'yaml-test-suite'
The package exports its entire test suite data (an array of objects) as the default export. This is the primary way to consume it in ESM projects.
yamlTestSuite
const yamlTestSuite = require('yaml-test-suite')
const { default: yamlTestSuite } = require('yaml-test-suite')
For CommonJS environments, `require` directly resolves to the default export. The `.default` property is generally not needed when importing the default export this way.
YamlTestSuiteData
import type { YamlTestSuiteData } from 'yaml-test-suite'
import { YamlTestSuiteData } from 'yaml-test-suite'
The package ships with TypeScript types. The main type for the entire suite is `YamlTestSuiteData`, which represents the array of test case objects. This is a type-only import.

This quickstart code loads the entire YAML test suite and logs basic statistics, then iterates through the first few test cases to display their structure, including filenames, names, tags, and truncated YAML input/JSON output of their sub-cases.

import yamlTestSuite from 'yaml-test-suite'; console.log(`Total YAML test cases loaded: ${yamlTestSuite.length}`); // Iterate and log details of the first 3 test cases to demonstrate structure for (let i = 0; i < Math.min(3, yamlTestSuite.length); i++) { const testCase = yamlTestSuite[i]; console.log(`\n--- Test Case ${i + 1} ---`); console.log(`Filename: ${testCase.filename}`); console.log(`Name: ${testCase.name}`); console.log(`Source: ${testCase.from}`); console.log(`Tags: ${testCase.tags.join(', ')}`); console.log(`Number of sub-cases: ${testCase.cases.length}`); if (testCase.cases.length > 0) { // Log a truncated version of the YAML input and expected JSON output console.log(`First sub-case input YAML (truncated):\n${testCase.cases[0].yaml?.substring(0, 100) || ''}...`); console.log(`First sub-case JSON output (truncated):\n${JSON.stringify(testCase.cases[0].json)?.substring(0, 100) || ''}...`); } }
Debug
Known issues
gotchaThe package is currently in an early development phase (v0.1.0). While it provides a stable dataset, the internal structure of the exported data objects (e.g., specific fields within each test case or sub-case) might undergo minor non-breaking changes in future 0.x releases. The overall array structure and general purpose are expected to remain consistent, but specific property access might need adjustment.
fix
Developers should consider pinning to an exact version (e.g., `0.1.0`) if relying on specific object property shapes, or thoroughly review release notes for any new 0.x releases to identify structural adjustments.
affects: <1.0.0
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
yaml-test-suite — npm install yaml-test-suite · libregistry