{"id":42018,"library":"structured-data-testing-tool","title":"Structured Data Testing Tool (SDTT)","description":"SDTT v4.5.0 is a library and CLI tool for inspecting and testing structured data on web pages, supporting JSON-LD, Microdata, and RDFa. It automatically detects Schema.org schemas in HTML or JSON sources, and includes built-in presets for Google, Twitter, Facebook, and social media meta tags. Users can create custom presets or schemas, and integrate with any test framework. The tool can accept URLs, files, strings, buffers, or streams, and output results to JSON. It is designed for ad-hoc testing or integration into CI/CD pipelines. Released under MIT license, it is actively maintained on GitHub.","status":"active","version":"4.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/glitchdigital/structured-data-testing-tool","tags":["javascript","Structured Data","JSON-LD","Microdata","RDFa","Testing"],"install":[{"cmd":"npm install structured-data-testing-tool","lang":"bash","label":"npm"},{"cmd":"yarn add structured-data-testing-tool","lang":"bash","label":"yarn"},{"cmd":"pnpm add structured-data-testing-tool","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTML parsing and traversal for extracting structured data from web pages","package":"cheerio","optional":false},{"reason":"DOM implementation for parsing HTML documents, required for RDFa support","package":"jsdom","optional":true},{"reason":"CLI argument parsing for the command line interface","package":"commander","optional":false}],"imports":[{"note":"SDTT is a named export, not default. ESM import preferred.","wrong":"const SDTT = require('structured-data-testing-tool').SDTT","symbol":"SDTT","correct":"import { SDTT } from 'structured-data-testing-tool'"},{"note":"Common mistake: using default import. This is a named export.","wrong":"import structuredDataTest from 'structured-data-testing-tool'","symbol":"structuredDataTest","correct":"import { structuredDataTest } from 'structured-data-testing-tool'"},{"note":"Use Presets to list built-in presets. Requires ESM.","wrong":null,"symbol":"Presets","correct":"import { Presets } from 'structured-data-testing-tool'"},{"note":"Low-level validation function for custom schemas.","wrong":null,"symbol":"validate","correct":"import { validate } from 'structured-data-testing-tool'"}],"quickstart":{"code":"import { structuredDataTest } from 'structured-data-testing-tool';\n\nasync function runTest() {\n  const result = await structuredDataTest('https://example.com/article', {\n    presets: ['Twitter', 'Facebook'],\n    schemas: ['Article']\n  });\n  console.log('Tests passed:', result.passed);\n  console.log('Errors:', result.errors);\n}\n\nrunTest().catch(console.error);","lang":"typescript","description":"Perform a structured data test on a URL against Twitter/Facebook presets and Article schema."},"warnings":[{"fix":"Update code to use async/await or .then() with the new Promise-based API.","message":"v4.0.0 changed the API from callback-based to async/await. All methods now return Promises.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Replace Presets.SocialMedia with explicit individual presets.","message":"Presets.SocialMedia is deprecated and will be removed in v5. Use presets: ['Twitter', 'Facebook'] instead.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Use --presets 'Twitter,Facebook' or supply multiple flags: -p Twitter -p Facebook.","message":"When using the CLI, the --presets and --schemas flags accept comma-separated lists without spaces (--presets Twitter,Facebook). Including spaces (e.g., --presets Twitter, Facebook) causes parsing errors.","severity":"gotcha","affected_versions":"*"},{"fix":"Update any scripts that parse the output file to handle the new nested format.","message":"The --output flag writes a JSON file with the full result object. In v4.5.0, the output format changed to include nested results; old parsers expecting the flat format may break.","severity":"deprecated","affected_versions":"<4.5.0"},{"fix":"Pass the full rendered HTML (e.g., from Puppeteer) as a string or buffer instead of URL.","message":"The library uses cheerio by default for HTML parsing. If testing pages with client-side-rendered content (e.g., React, Angular), structured data may not be found unless you provide a headless browser result.","severity":"gotcha","affected_versions":"*"},{"fix":"Update imports from const SDTT = require(...) to import { structuredDataTest } from '...'.","message":"Import paths changed in v3.0.0: require('structured-data-testing-tool') no longer works. Must use destructured imports like { structuredDataTest }.","severity":"breaking","affected_versions":"<3.0.0"}],"env_vars":null,"search_vec":"'accept':71 'activ':102 'ad':88 'ad-hoc':87 'automat':31 'buffer':75 'built':43 'built-in':42 'ci/cd':94 'cli':12 'creat':57 'custom':58 'data':2,19,108 'design':85 'detect':32 'facebook':49 'file':73 'framework':67 'github':105 'googl':47 'hoc':89 'html':36 'includ':41 'inspect':15 'integr':63,92 'javascript':106 'json':25,38,82,110 'json-ld':24,109 'ld':26,111 'librari':10 'licens':99 'maintain':103 'media':52 'meta':53 'microdata':27,112 'mit':98 'output':79 'page':22 'pipelin':95 'preset':45,59 'rdfa':29,113 'releas':96 'result':80 'schema':34,61 'schema.org':33 'sdtt':5,6 'social':51 'sourc':39 'stream':77 'string':74 'structur':1,18,107 'support':23 'tag':54 'test':3,17,66,90,114 'tool':4,13,69 'twitter':48 'url':72 'user':55 'v4.5.0':7 'web':21","created_at":"2026-06-04T18:55:13.253908+00:00","updated_at":"2026-06-04T18:55:13.253908+00:00","problems":[{"fix":"Use named import: import { structuredDataTest } from 'structured-data-testing-tool'","cause":"Using default import instead of named import: import structuredDataTest from 'structured-data-testing-tool'","error":"TypeError: structuredDataTest is not a function"},{"fix":"Run npm install structured-data-testing-tool","cause":"Package not installed or missing from node_modules","error":"Error: Cannot find module 'structured-data-testing-tool'"},{"fix":"Upgrade Node.js to version 14 or higher","cause":"Node.js version is too old to support nullish coalescing operator used by the library (requires Node >= 14)","error":"SyntaxError: Unexpected token '??'"},{"fix":"Use the --file option with locally saved HTML or pass a headless browser response instead","cause":"The target URL is blocking automated requests (e.g., bot detection)","error":"Error: Request failed with status 403"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/glitchdigital/structured-data-testing-tool#readme","github":"https://github.com/glitchdigital/structured-data-testing-tool","docs":null,"changelog":null,"pypi":null,"npm":"structured-data-testing-tool","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","search"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}