{"id":15664,"library":"json-ld-test-suite","title":"JSON-LD Conformance Test Suite","description":"The `json-ld-test-suite` npm package provides a snapshot of the official JSON-LD Conformance Test Suite, designed to verify the compliance of JSON-LD processors against the JSON-LD 1.0 and 1.1 specifications. While this specific npm package (version 1.0.1) was last published over eight years ago and is effectively abandoned, the underlying JSON-LD Test Suite on GitHub (json-ld/json-ld.org) remains actively maintained and updated by the JSON-LD community. This suite is crucial for implementers, offering test cases for operations such as compaction, expansion, framing, normalization, and RDF conversion. It differentiates itself by being the authoritative W3C test suite, essential for ensuring interoperability and specification adherence across different JSON-LD processor implementations, though consumers of *this npm package* should be aware of its static nature.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/json-ld/json-ld.org","tags":["javascript","json-ld"],"install":[{"cmd":"npm install json-ld-test-suite","lang":"bash","label":"npm"},{"cmd":"yarn add json-ld-test-suite","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-ld-test-suite","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package primarily consists of JSON-LD data files. Direct import/require of specific JSON files is the common access pattern. Use the full path.","wrong":"const manifest = require('json-ld-test-suite/manifest.jsonld')","symbol":"manifest","correct":"import manifest from 'json-ld-test-suite/tests/manifest.jsonld'"},{"note":"Individual test files are also directly accessible via their full path within the 'tests' directory. Path must be exact.","wrong":"const testCase = require('json-ld-test-suite/compact-0001-in.jsonld')","symbol":"testCase","correct":"import testCase from 'json-ld-test-suite/tests/compact-0001-in.jsonld'"},{"note":"Some test files are `.sparql` files. In ESM, use a raw import if your bundler supports it (e.g., Vite, Webpack asset modules) to get the string content. For CJS, use `fs.readFileSync`.","symbol":"sparqlQuery","correct":"import sparqlQuery from 'json-ld-test-suite/tests/rdf-0001.sparql?raw'"}],"quickstart":{"code":"import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = fileURLToPath(new URL('.', import.meta.url));\n\n// Assuming the package is installed at node_modules/json-ld-test-suite\nconst packageRoot = join(__dirname, '../node_modules/json-ld-test-suite');\n\n// Load the main manifest for all tests\nconst manifestPath = join(packageRoot, 'tests/manifest.jsonld');\nconst manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));\n\nconsole.log(`Loaded JSON-LD Test Suite Manifest (v${manifest.version || 'unknown'})`);\nconsole.log(`Number of manifests: ${manifest.sequence.length}`);\n\n// Example: Accessing a specific test entry\nconst firstManifest = manifest.sequence[0];\nconsole.log(`First test manifest type: ${firstManifest['@type']}`);\n\n// To load an actual test input file, you'd typically iterate through the manifest\n// and construct paths based on the 'input' property of each test entry.\n// For example, if a test entry has 'input': 'compact-0001-in.jsonld'\nconst exampleInputPath = join(packageRoot, 'tests/compact-0001-in.jsonld');\nconst exampleInput = JSON.parse(readFileSync(exampleInputPath, 'utf8'));\nconsole.log('Example test input data:', exampleInput);\n","lang":"typescript","description":"Demonstrates how to programmatically load the `json-ld-test-suite` manifest and individual test files from the file system, typically for building a conformance testing harness. This snippet uses Node.js `fs` and `path` modules to read JSON-LD and SPARQL files as raw data."},"warnings":[{"fix":"For the latest test suite data, clone the git repository directly: `git clone git://github.com/json-ld/json-ld.org.git` or use a different, more current distribution of the JSON-LD test suite.","message":"This npm package (json-ld-test-suite@1.0.1) has not been updated in over eight years. While the underlying JSON-LD Conformance Test Suite at json-ld/json-ld.org is actively maintained, updates to the test suite data are not reflected in this npm package. Users requiring the latest test data should consider fetching directly from the GitHub repository or using a different distribution method.","severity":"gotcha","affected_versions":"=1.0.1"},{"fix":"Before running a test, inspect its `processingMode` property. If present, ensure your processor's mode matches or skip the test if incompatible. If `processingMode` is absent, the test is generally compatible with both 1.0 and 1.1.","message":"Tests are often marked with specific `processingMode` requirements (e.g., `json-ld-1.0` or `json-ld-1.1`). Processors must only run tests compatible with their implemented JSON-LD version, otherwise, false positives or negatives will occur.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If encountering unexpected test failures that are not due to your processor, check the upstream `json-ld/json-ld.org` repository for recent changes, bug reports, or contact the JSON-LD mailing list (public-linked-json@w3.org) for clarification.","message":"Due to its community-driven nature, the JSON-LD Test Suite (the upstream data, not this npm package) 'may become unstable from time to time.' This means new test contributions or fixes could temporarily introduce regressions or inconsistencies, which are typically resolved quickly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Use the correct full path to the JSON file: `import manifest from 'json-ld-test-suite/tests/manifest.jsonld'` (ESM) or `const manifest = require('json-ld-test-suite/tests/manifest.jsonld')` (CJS).","cause":"Incorrect path or attempting to import a non-existent JavaScript module. The `manifest.jsonld` file is located within the `tests/` subdirectory of the package.","error":"Error: Cannot find module 'json-ld-test-suite/manifest.jsonld'"},{"fix":"Ensure you are targeting actual JSON-LD (`.jsonld`) files for `JSON.parse`. For `.sparql` files, read them as plain text/strings. For example, using a raw import query parameter in ESM (`import query from './my.sparql?raw'`).","cause":"Attempting to parse an XML/HTML file (like vocab.html) or a non-JSON file (like .sparql) as JSON. This can happen if the wrong file is targeted or if a raw import of a `.sparql` file is not handled correctly.","error":"SyntaxError: Unexpected token '<' at JSON.parse (<anonymous>)"}],"ecosystem":"npm"}