{"record":{"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":142,"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":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/typecheck/typechecker.ts#L124-L160","documentation":"When typecheck runs, Vitest captures the tsc/vue-tsc stdout and checks for help-text markers ('The TypeScript Compiler - Version' / 'COMMON COMMANDS'). Their presence means tsc could not find a tsconfig and printed its help banner instead of type errors. Vitest throws a structured error listing the configured tsconfig path and remediation steps.","triggerScenarios":"test.typecheck.enabled is on, but the tsconfig referenced by test.typecheck.tsconfig (default 'tsconfig.json') does not exist, is not valid JSON, or tsc was invoked from a cwd where it cannot discover any config, so it emits help text.","commonSituations":"Renamed/moved tsconfig.json, set test.typecheck.tsconfig to a wrong path, ran from a workspace root without a tsconfig, or the tsconfig file is corrupt/malformed JSON.","solutions":["Create or restore tsconfig.json at the project root.","Point test.typecheck.tsconfig at the correct path in vitest.config.","Validate the tsconfig is well-formed JSON (run tsc --noEmit -p <path> directly to confirm).","If in a monorepo, ensure the typecheck command resolves the per-package tsconfig."],"exampleFix":"// before\nexport default defineConfig({ test: { typecheck: { enabled: true, tsconfig: './tsconfig.test.json' } } })\n// but ./tsconfig.test.json is missing\n\n// after\nexport default defineConfig({ test: { typecheck: { enabled: true, tsconfig: './tsconfig.json' } } })","handlingStrategy":"validation","validationCode":"import { existsSync, readFileSync } from 'node:fs'\nfunction assertTsconfig(path) {\n  if (!existsSync(path)) throw new Error('tsconfig missing: ' + path)\n  JSON.parse(readFileSync(path, 'utf8'))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a tsconfig.json at the project root or set test.typecheck.tsconfig.","Validate tsconfig JSON before enabling typecheck.","In monorepos, point typecheck.tsconfig at the per-package config."],"tags":["typecheck","typescript","tsconfig","config"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}