{"record":{"id":"1ff0255d094bd530","repo":"evanw/esbuild","slug":"missing-yaml-metadata","errorCode":null,"errorMessage":"Missing YAML metadata","messagePattern":"Missing YAML metadata","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/test262.js","lineNumber":437,"sourceCode":"  console.log(`\\n${dimColor}Installing esbuild...${resetColor}`)\n  const esbuild = installForTests()\n\n  console.log(`\\n${dimColor}Running tests...${resetColor}\\n`)\n  const errorCounts = {}\n  let skippedCount = 0\n\n  await forEachInParallel(files, 32, async (file) => {\n    // Don't parse files that esbuild deliberately handles differently\n    if (skipTheseTests.has(path.relative(testDir, file))) {\n      skippedCount++\n      return\n    }\n\n    try {\n      const content = fs.readFileSync(file, 'utf8')\n      const start = content.indexOf('/*---')\n      const end = content.indexOf('---*/')\n      if (start < 0 || end < 0) throw new Error(`Missing YAML metadata`)\n      const yaml = jsYaml.safeLoad(content.slice(start + 5, end))\n\n      // Don't parse files that test things we don't care about\n      if (yaml.features && yaml.features.some(feature => skipTheseFeatures.has(feature))) {\n        skippedCount++\n        return\n      }\n\n      await checkTransformAPI({ esbuild, file, content, yaml })\n      await checkBuildAPI({ esbuild, file, content, yaml })\n    }\n\n    catch (error) {\n      errorCounts[error.kind] = (errorCounts[error.kind] || 0) + 1\n      printError(file, error)\n    }\n  })\n","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/evanw/esbuild/blob/f6058f8364fe7ab91ca57a83e02577ed74c9cae4/scripts/test262.js#L419-L455","documentation":"Thrown at scripts/test262.js:437. Each test262 conformance file must contain a YAML metadata block delimited by `/*---` and `---*/`. The harness locates these markers with indexOf; if either marker is absent (indexOf returns -1) the file is rejected because the harness cannot read the flags, includes, and features metadata it needs to run the test.","triggerScenarios":"Running scripts/test262.js against a test262 tree where one or more .js files lack the standard `/*--- ... ---*/` front-matter block — e.g. a harness helper file, a malformed fixture, or a file from a test262 checkout whose format changed.","commonSituations":"The test262 submodule/checkout is updated to a version that renamed markers, a non-test file is accidentally included in the test glob, or a locally-added fixture omits the YAML header.","solutions":["Confirm the failing file is actually a test262 test (not a harness/helper file) and should have metadata.","Ensure the file contains a `/*---` ... `---*/` block with valid YAML (description, flags, includes as needed).","If the file is legitimately header-less, exclude it from the file glob in scripts/test262.js."],"exampleFix":"// before (file body only)\nvar x = 1;\nassert.sameValue(x, 1);\n\n// after (YAML metadata block added)\n/*---\ndescription: basic assign test\nflags: []\n---*/\nvar x = 1;\nassert.sameValue(x, 1);","handlingStrategy":"validation","validationCode":"function hasTest262Metadata(content) {\n  return content.indexOf('/*---') >= 0 && content.indexOf('---*/') >= 0;\n}","typeGuard":null,"tryCatchPattern":"try { const yaml = loadTest262Yaml(content); }\ncatch (e) {\n  if (/Missing YAML metadata/.test(e.message)) console.error('File lacks a /*--- ... ---*/ metadata block');\n  throw e;\n}","preventionTips":["Ensure every test262 fixture carries the standard `/*--- ... ---*/` YAML front matter.","Exclude non-test helper files from the test glob in scripts/test262.js.","Validate metadata presence before running jsYaml.safeLoad."],"tags":["test-harness","test262","yaml","metadata","validation"],"backgroundTag":null,"analyzedSha":"f6058f8364fe7ab91ca57a83e02577ed74c9cae4","analyzedAt":"2026-08-09T18:37:22.223Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}