evanw/esbuild · error · Error

Included file is missing: ${include}

Error message

Included file is missing: ${include}

What it means

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.

Source

Thrown at scripts/test262.js:529

  if (entry.startsWith('.') || !entry.endsWith('.js')) {
    continue
  }
  const file = path.join(harnessDir, entry)
  const content = fs.readFileSync(file, 'utf8')
  if (entry === 'assert.js' || entry === 'sta.js') {
    defaultHarness += content
    continue
  }
  harnessFiles.set(entry, content)
}

function createHarnessForTest(yaml) {
  let harness = defaultHarness

  if (yaml.includes) {
    for (const include of yaml.includes) {
      const content = harnessFiles.get(include)
      if (!content) throw new Error(`Included file is missing: ${include}`)
      harness += content
    }
  }

  return harness
}

async function runCodeInHarness(yaml, code, importDir) {
  const context = {}
  const isAsync = yaml.flags && yaml.flags.includes('async')
  const isModule = yaml.flags && yaml.flags.includes('module')
  const isRaw = yaml.flags && yaml.flags.includes('raw')

  // See: https://github.com/nodejs/node/issues/36351
  const unique = () => '//' + Math.random()

  const runCode = async () => {
    const moduleCache = new Map

View on GitHub (pinned to f6058f8364)

Solutions

  1. Verify the harness directory path used by scripts/test262.js is correct and fully populated (update the test262 checkout if needed).
  2. Check the includes entry for typos against the actual filename in the harness directory.
  3. If the harness file genuinely should not be required, remove it from the test's `includes` YAML field.

Example fix

// before (test YAML references a missing helper)
/*---
description: test
includes: [propertyHelpr.js]
---*/

// after (correct filename)
/*---
description: test
includes: [propertyHelper.js]
---*/
Defensive patterns

Strategy: validation

Validate before calling

function allIncludesPresent(yaml, harnessFiles) {
  if (!yaml.includes) return true;
  const missing = yaml.includes.filter(name => !harnessFiles.has(name));
  return missing.length === 0 ? null : missing;
}

Try / catch

try { createHarnessForTest(yaml); }
catch (e) {
  if (/Included file is missing/.test(e.message)) console.error('A referenced harness file is absent from harnessDir:', e.message);
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of evanw/esbuild@f6058f8364 (2026-08-09). Data as JSON: /api/errors/edeadefa90377690. Report an issue: GitHub.