{"id":"d79db8d880afcdc3","repo":"vitest-dev/vitest","slug":"typescript-compiler-returned-help-text-instead-of","errorCode":null,"errorMessage":"TypeScript compiler returned help text instead of type checking results.\nThis usually means the tsconfig file was not found.\n\nPossible solutions:\n  1. Ensure '${tsconfigPath}' exists in your project root\n  2. If using a custom tsconfig, verify the path in your Vitest config:\n     test: { typecheck: { tsconfig: 'path/to/tsconfig.json' } }\n  3. Check that the tsconfig file is valid JSON","messagePattern":"TypeScript compiler returned help text instead of type checking results\\.\nThis usually means the tsconfig file was not found\\.\n\nPossible solutions:\n  1\\. Ensure '(.+?)' exists in your project root\n  2\\. If using a custom tsconfig, verify the path in your Vitest config:\n     test: (.+?) \\}\n  3\\. Check that the tsconfig file is valid JSON","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/typecheck/typechecker.ts","lineNumber":139,"sourceCode":"  protected async prepareResults(output: string): Promise<{\n    files: File[]\n    sourceErrors: TestError[]\n    time: number\n  }> {\n    // Detect if tsc output is help text instead of error output\n    // This happens when tsconfig.json is missing and tsc can't find any config\n    if (output.includes('The TypeScript Compiler - Version') || output.includes('COMMON COMMANDS')) {\n      const { typecheck } = this.project.config\n      const tsconfigPath = typecheck.tsconfig || 'tsconfig.json'\n      const msg = `TypeScript compiler returned help text instead of type checking results.\\n`\n        + `This usually means the tsconfig file was not found.\\n\\n`\n        + `Possible solutions:\\n`\n        + `  1. Ensure '${tsconfigPath}' exists in your project root\\n`\n        + `  2. If using a custom tsconfig, verify the path in your Vitest config:\\n`\n        + `     test: { typecheck: { tsconfig: 'path/to/tsconfig.json' } }\\n`\n        + `  3. Check that the tsconfig file is valid JSON`\n\n      throw new Error(msg)\n    }\n\n    const typeErrors = await this.parseTscLikeOutput(output)\n    const testFiles = new Set(this.getFiles())\n\n    if (!this._tests) {\n      this._tests = await this.collectTests()\n    }\n\n    const sourceErrors: TestError[] = []\n    const files: File[] = []\n\n    testFiles.forEach((path) => {\n      const { file, definitions, map, parsed } = this._tests![path]\n      const errors = typeErrors.get(path)\n      files.push(file)\n      if (!errors) {\n        this.markPassed(file)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/typecheck/typechecker.ts#L121-L157","documentation":"The typechecker inspects tsc/vue-tsc stdout and, if it contains the compiler help banner ('The TypeScript Compiler - Version' or 'COMMON COMMANDS'), concludes no tsconfig was found and throws (typechecker.ts:128-140). tsc prints help text exactly when it is invoked without a resolvable tsconfig via -p/--build.","triggerScenarios":"Enabling test.typecheck with a tsconfig path that does not exist, is a directory without tsconfig.json, or is unreachable because the root/cwd is wrong. The checker is spawned with `-p <tsconfigPath>` (or --build) and tsc emits its help banner instead of diagnostics.","commonSituations":"Renamed/moved tsconfig.json; set typecheck.tsconfig to a relative path that does not resolve from config.root; monorepo where the tsconfig lives in a package subdir but root points elsewhere; fresh checkout that did not generate a tsconfig.","solutions":["Confirm the tsconfig file (default tsconfig.json) exists at config.root.","Set test.typecheck.tsconfig to the correct relative or absolute path in vitest.config.","Validate the tsconfig is parseable JSON (run `tsc --noEmit -p <path>` manually to verify).","Ensure config.root points at the directory containing the tsconfig."],"exampleFix":"// before: wrong tsconfig path\nexport default defineConfig({\n  test: { typecheck: { tsconfig: './tsconfigs/main.json' } },\n})\n\n// after: correct path\nexport default defineConfig({\n  test: { typecheck: { tsconfig: './tsconfig.json' } },\n})","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nfunction assertTsconfigExists(root: string, tsconfig?: string) {\n  const path = resolve(root, tsconfig || 'tsconfig.json')\n  if (!existsSync(path)) {\n    throw new Error(`tsconfig not found at '${path}' (configured typecheck.tsconfig)`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep tsconfig.json at config.root, or set typecheck.tsconfig explicitly.","Run `tsc -p <path> --noEmit` locally to confirm the tsconfig resolves before enabling typecheck.","In monorepos, point typecheck.tsconfig at the package-local tsconfig."],"tags":["typecheck","typescript","tsconfig","config"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}