{"id":"0af9e59d78a31cc4","repo":"vitest-dev/vitest","slug":"basereporter-s-parseconfigmodule-was-not-overwritt","errorCode":null,"errorMessage":"BaseReporter's parseConfigModule was not overwritten","messagePattern":"BaseReporter's parseConfigModule was not overwritten","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/coverage.ts","lineNumber":256,"sourceCode":"    }\n\n    const rootMapper = this.getUntestedFilesByRoot.bind(this, testedFiles, this.options.include)\n\n    const matrix = await Promise.all(this.roots.map(rootMapper))\n\n    return matrix.flatMap(files => files)\n  }\n\n  createCoverageMap(): CoverageMap {\n    throw new Error('BaseReporter\\'s createCoverageMap was not overwritten')\n  }\n\n  async generateReports(_: CoverageMap, __: boolean | undefined): Promise<void> {\n    throw new Error('BaseReporter\\'s generateReports was not overwritten')\n  }\n\n  async parseConfigModule(_: string): Promise<{ generate: () => { code: string } }> {\n    throw new Error('BaseReporter\\'s parseConfigModule was not overwritten')\n  }\n\n  resolveOptions(): ResolvedCoverageOptions {\n    return this.options\n  }\n\n  async clean(clean = true): Promise<void> {\n    await this.reportsDirectoryLock.acquire()\n\n    if (clean && existsSync(this.options.reportsDirectory)) {\n      await fs.rm(this.options.reportsDirectory, {\n        recursive: true,\n        force: true,\n        maxRetries: 10,\n      })\n    }\n\n    if (existsSync(this.coverageFilesDirectory)) {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/coverage.ts#L238-L274","documentation":"BaseReporter.parseConfigModule() (coverage.ts:256) is the abstract-style stub. It is used by the thresholds.autoUpdate flow to AST-parse the user's config file; if a custom reporter doesn't implement it, autoUpdate cannot rewrite thresholds.","triggerScenarios":"coverage.thresholds.autoUpdate is enabled and the active reporter (a custom BaseReporter subclass) didn't override parseConfigModule when vitest tries to update thresholds.","commonSituations":"Custom reporter used together with thresholds.autoUpdate without overriding the config-parsing method.","solutions":["Implement async parseConfigModule(path) in your custom reporter using magicast (see the built-in implementation).","Disable coverage.thresholds.autoUpdate when using a reporter that can't rewrite config.","Extend a concrete reporter that already implements parseConfigModule."],"exampleFix":"// before\nclass MyReporter extends BaseReporter {}\n// with coverage.thresholds.autoUpdate = true\n\n// after\nclass MyReporter extends BaseReporter {\n  async parseConfigModule(path: string) {\n    return (await parseModule(await fs.readFile(path, 'utf-8')))\n  }\n}","handlingStrategy":"type-guard","validationCode":"if (reporter.parseConfigModule === BaseReporter.prototype.parseConfigModule\n    && config.coverage.thresholds.autoUpdate) {\n  throw new Error('Reporter cannot autoUpdate thresholds; override parseConfigModule or disable autoUpdate')\n}","typeGuard":"function overridesParseConfigModule(r: BaseReporter): boolean {\n  return r.parseConfigModule !== BaseReporter.prototype.parseConfigModule\n}","tryCatchPattern":null,"preventionTips":["Only enable thresholds.autoUpdate with a reporter that implements parseConfigModule.","Use the built-in reporter for autoUpdate; disable it for custom minimal reporters.","Document the override contract for any custom reporter."],"tags":["coverage","reporters","thresholds","autoupdate","extensibility"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}