{"record":{"id":"edeadefa90377690","repo":"evanw/esbuild","slug":"included-file-is-missing-include","errorCode":null,"errorMessage":"Included file is missing: ${include}","messagePattern":"Included file is missing: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/test262.js","lineNumber":529,"sourceCode":"  if (entry.startsWith('.') || !entry.endsWith('.js')) {\n    continue\n  }\n  const file = path.join(harnessDir, entry)\n  const content = fs.readFileSync(file, 'utf8')\n  if (entry === 'assert.js' || entry === 'sta.js') {\n    defaultHarness += content\n    continue\n  }\n  harnessFiles.set(entry, content)\n}\n\nfunction createHarnessForTest(yaml) {\n  let harness = defaultHarness\n\n  if (yaml.includes) {\n    for (const include of yaml.includes) {\n      const content = harnessFiles.get(include)\n      if (!content) throw new Error(`Included file is missing: ${include}`)\n      harness += content\n    }\n  }\n\n  return harness\n}\n\nasync function runCodeInHarness(yaml, code, importDir) {\n  const context = {}\n  const isAsync = yaml.flags && yaml.flags.includes('async')\n  const isModule = yaml.flags && yaml.flags.includes('module')\n  const isRaw = yaml.flags && yaml.flags.includes('raw')\n\n  // See: https://github.com/nodejs/node/issues/36351\n  const unique = () => '//' + Math.random()\n\n  const runCode = async () => {\n    const moduleCache = new Map","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/evanw/esbuild/blob/f6058f8364fe7ab91ca57a83e02577ed74c9cae4/scripts/test262.js#L511-L547","documentation":"Thrown by createHarnessForTest() in scripts/test262.js:529. A test's YAML `includes` field lists harness helper files (e.g. `propertyHelper.js`, `assertRelativeDateMs.js`) that must be prepended to the test before execution. The harness looks each name up in the harnessFiles map, populated up front from the test262 harness directory; a missing name raises this error.","triggerScenarios":"A test262 test declares `includes: [someHelper.js]` but `someHelper.js` is not present in the harness directory (harnessDir) that scripts/test262.js scanned at startup. Causes include a renamed/removed harness file upstream, a stale checkout, or a typo in the includes list.","commonSituations":"Updating the test262 submodule pulls in a test that references a brand-new or renamed harness file not yet present, or the harnessDir constant in scripts/test262.js points at the wrong path.","solutions":["Verify the harness directory path used by scripts/test262.js is correct and fully populated (update the test262 checkout if needed).","Check the includes entry for typos against the actual filename in the harness directory.","If the harness file genuinely should not be required, remove it from the test's `includes` YAML field."],"exampleFix":"// before (test YAML references a missing helper)\n/*---\ndescription: test\nincludes: [propertyHelpr.js]\n---*/\n\n// after (correct filename)\n/*---\ndescription: test\nincludes: [propertyHelper.js]\n---*/","handlingStrategy":"validation","validationCode":"function allIncludesPresent(yaml, harnessFiles) {\n  if (!yaml.includes) return true;\n  const missing = yaml.includes.filter(name => !harnessFiles.has(name));\n  return missing.length === 0 ? null : missing;\n}","typeGuard":null,"tryCatchPattern":"try { createHarnessForTest(yaml); }\ncatch (e) {\n  if (/Included file is missing/.test(e.message)) console.error('A referenced harness file is absent from harnessDir:', e.message);\n  throw e;\n}","preventionTips":["Keep the test262 checkout/harness directory in sync with the tests being run.","Verify every name in a test's `includes` exists in harnessDir before running.","Watch for upstream harness-file renames when bumping the test262 submodule."],"tags":["test-harness","test262","harness","includes","validation"],"backgroundTag":null,"analyzedSha":"f6058f8364fe7ab91ca57a83e02577ed74c9cae4","analyzedAt":"2026-08-09T18:37:22.223Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}