vitest-dev/vitest · error · Error

No projects were found in

Error message

No projects were found in "${relativeFile}". Make sure your configuration is correct.

What it means

After resolving a container's declared project entries, if the result is empty (no children were produced), Vitest throws naming the container's relativeFile. A container config declared 'projects' but resolved to nothing, which would silently produce zero tests, so it is treated as a configuration error.

Solutions

  1. Verify the container's 'projects' definition actually yields entries.
  2. Check globs/paths in the projects definition resolve to real files/configs.
  3. Remove filters that hide every project for this container, or remove the empty container.
  4. Run with verbose logging to see what each projects entry resolved to.

Example fix

// before
export default defineConfig({ projects: [] })
// after
export default defineConfig({ projects: ['./packages/*'] })
Defensive patterns

Strategy: validation

Validate before calling

// Ensure a container's projects definition resolves to something.
function assertNonEmpty<T>(items: T[], container: string) {
  if (!items.length) throw new Error(`Container "${container}" declared projects but resolved none.`)
}

Type guard

const hasChildren = <T>(items: T[]): items is [T, ...T[]] => items.length > 0

Prevention

When it happens

Trigger: A config file declares 'projects: [...] ' but every entry resolves to nothing (empty globs, all filters excluded, or definitions that yield no projects).

Common situations: An empty projects array, a glob that matches no files, all entries being hidden/filtered, or a projects function that returns nothing.

Related errors


AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11). Data as JSON: /api/errors/e8226c0cd149f26b. Report an issue: GitHub.

Appendix: source

Thrown at packages/vitest/src/node/projects/resolveProjects.ts:468

      chain = [...chain, realConfigFile]
      context.containerConfigFiles.push(configFile)
    }

    const childContext: ProjectsResolutionContext = {
      ...context,
      parentViteConfig: entry.viteConfig,
      parentConfig: entry.projectConfig,
      ancestors: [...context.ancestors, entry.projectConfig.name],
      chain,
    }
    const children = await resolveDeclaredProjectEntries(childContext, definitions)
    // the raw config was only needed to resolve this container's projects,
    // which are all known by now; the resolved container config outlives this
    // resolution (children keep its server alive), so don't let it retain the
    // raw copy for the whole session
    entry.projectConfig._rawTestConfig = undefined
    if (!children.length) {
      throw new Error(
        `No projects were found in "${relativeFile}". Make sure your configuration is correct.`,
      )
    }
    result.push(...children)
  }
  return result
}

function safeRealpath(path: string): string {
  try {
    return realpathSync(path)
  }
  catch {
    return path
  }
}

/**

View on GitHub (pinned to 1fa9837ec2)