{"record":{"id":"c3958e902f3b7602","repo":"docmirror/dev-sidecar","slug":"tests-directory-not-found-resolveddir","errorCode":null,"errorMessage":"Tests directory not found: ${resolvedDir}","messagePattern":"Tests directory not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/modules/plugin/free-eye/client.js","lineNumber":55,"sourceCode":"const pluginRequire = createRequire(path.join(PLUGIN_ROOT, 'index.js'))\n\nfunction resolveTestsDir (customDir) {\n  const fallbackDir = path.join(PLUGIN_ROOT, TEST_PACKAGE_DIR)\n  if (!customDir) {\n    return fallbackDir\n  }\n  if (path.isAbsolute(customDir)) {\n    return fs.existsSync(customDir) ? customDir : fallbackDir\n  }\n  const candidate = path.join(PLUGIN_ROOT, customDir)\n  return fs.existsSync(candidate) ? candidate : fallbackDir\n}\n\nasync function loadAllTests (testsDir, globalConfig) {\n  const tests = []\n  const resolvedDir = resolveTestsDir(testsDir)\n  if (!fs.existsSync(resolvedDir)) {\n    throw new Error(`Tests directory not found: ${resolvedDir}`)\n  }\n  const files = fs.readdirSync(resolvedDir).filter(file => file.endsWith('.js') && file !== '__init__.js')\n\n  for (const file of files) {\n    const modulePath = path.join(resolvedDir, file)\n\n    const module = pluginRequire(modulePath)\n    const getClientTests = module.getClientTests || (module.default && module.default.getClientTests)\n    if (typeof getClientTests === 'function') {\n      for (const testCls of getClientTests()) {\n        if (testCls.getTestTag() in globalConfig) {\n          tests.push(testCls)\n        }\n      }\n    }\n  }\n  return tests\n}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/modules/plugin/free-eye/client.js#L37-L73","documentation":"`loadAllTests` in the free-eye plugin resolves the tests directory via `resolveTestsDir(testsDir)` and throws if that directory does not exist on disk. It refuses to continue rather than silently returning zero tests. The resolved path is included in the message so you can see exactly what was looked for.","triggerScenarios":"Calling `runTests({ testsDir })` (via `todoTests`) where `resolveTestsDir` produces a path that does not exist — e.g. an absolute `testsDir` that was never created, a wrong relative path, or the free-eye test assets missing from a packaged install.","commonSituations":"Passing a testsDir relative to the wrong working directory; renaming/moving the tests folder; packaged binaries where the tests directory is not bundled; typos in a config file pointing at the tests dir.","solutions":["Verify the resolved path printed in the error exists (`ls <resolvedDir>`) and fix `testsDir` accordingly.","Pass an absolute path for `testsDir` so it does not depend on process.cwd().","If running the packaged app, ensure the tests directory is bundled with the application assets.","Create the directory with at least one `.js` test file if it is meant to be populated at runtime."],"exampleFix":"// before\nawait runTests({ testsDir: 'tests/free-eye' })\n// after\nconst path = require('path')\nawait runTests({ testsDir: path.join(__dirname, 'tests/free-eye') })","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nconst path = require('path')\nconst resolvedDir = path.isAbsolute(testsDir) ? testsDir : path.resolve(process.cwd(), testsDir)\nif (!fs.existsSync(resolvedDir)) {\n  throw new Error(`Fix testsDir before calling runTests: ${resolvedDir} missing`)\n}","typeGuard":"function hasTestsDir (testsDir) {\n  return typeof testsDir === 'string' && testsDir.length > 0 && fs.existsSync(testsDir)\n}","tryCatchPattern":"try {\n  await runTests({ testsDir, config })\n} catch (err) {\n  if (err.message.startsWith('Tests directory not found')) {\n    console.error('Point testsDir at an existing directory:', err.message)\n  } else { throw err }\n}","preventionTips":["Always pass absolute paths for testsDir","Verify the directory exists after install/packaging steps","Ensure test assets are included in packaged bundles","Keep testsDir configuration in one reviewed place"],"tags":["filesystem","free-eye","missing-directory"],"backgroundTag":"directory-not-found","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}