{"record":{"id":"92a030744fd5adc3","repo":"jestjs/jest","slug":"jest-haste-map-enablesymlinks-config-option-was-s","errorCode":null,"errorMessage":"jest-haste-map: enableSymlinks config option was set, but is incompatible with watchman.\nSet either `enableSymlinks` to false or `useWatchman` to false.","messagePattern":"jest-haste-map: enableSymlinks config option was set, but is incompatible with watchman\\.\nSet either `enableSymlinks` to false or `useWatchman` to false\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-haste-map/src/index.ts","lineNumber":263,"sourceCode":"    this._console = options.console || globalThis.console;\n\n    if (options.ignorePattern) {\n      if (options.ignorePattern instanceof RegExp) {\n        this._options.ignorePattern = new RegExp(\n          `${options.ignorePattern.source}|${VCS_DIRECTORIES}`,\n          options.ignorePattern.flags,\n        );\n      } else {\n        throw new TypeError(\n          'jest-haste-map: the `ignorePattern` option must be a RegExp',\n        );\n      }\n    } else {\n      this._options.ignorePattern = new RegExp(VCS_DIRECTORIES);\n    }\n\n    if (this._options.enableSymlinks && this._options.useWatchman) {\n      throw new Error(\n        'jest-haste-map: enableSymlinks config option was set, but ' +\n          'is incompatible with watchman.\\n' +\n          'Set either `enableSymlinks` to false or `useWatchman` to false.',\n      );\n    }\n\n    this._ignoreFn = buildIgnoreMatcher(\n      this._options.ignorePattern,\n      this._options.retainAllFiles,\n    );\n    this._workerPool = new WorkerPool({\n      maxWorkers: this._options.maxWorkers,\n      workerPath: require.resolve('./worker'),\n      workerThreads: this._options.workerThreads,\n    });\n    this._fileProcessor = new FileProcessor(\n      {\n        computeDependencies: this._options.computeDependencies,","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-haste-map/src/index.ts#L245-L281","documentation":"jest-haste-map cannot follow symlinks when using the watchman crawler backend, because watchman resolves real paths and would index files under incorrect paths. When both `enableSymlinks: true` and `useWatchman: true` (the default) are set, the constructor throws immediately to prevent silent mis-indexing. This is a hard incompatibility, not a performance warning.","triggerScenarios":"Setting `haste.enableSymlinks: true` in jest.config while leaving `useWatchman` at its default true. The guard at index.ts:262 checks `this._options.enableSymlinks && this._options.useWatchman` and throws.","commonSituations":"Monorepo setups (pnpm, Yarn workspaces with symlinks) that enable symlink support for correct module resolution but forget to disable watchman. Also when copying a config snippet that sets enableSymlinks without the companion useWatchman:false.","solutions":["Set `haste: { enableSymlinks: true }` AND pass `watchman: false` (e.g. `--watchman=false` CLI flag or `globalConfig.watchman = false`).","If you do not actually need symlink following, leave `enableSymlinks` at its default false and keep watchman.","In a custom HasteMap caller, pass `useWatchman: false` in the options object alongside `enableSymlinks: true`."],"exampleFix":"// before\nmodule.exports = {\n  haste: { enableSymlinks: true },\n  // watchman defaults to true → conflict\n};\n// after\nmodule.exports = {\n  haste: { enableSymlinks: true },\n  // disable watchman so the node crawler (fdir) handles symlinks\n};\n// CLI: jest --watchman=false","handlingStrategy":"validation","validationCode":"// Validate config compatibility before HasteMap.create.\nfunction validateHasteOptions(opts: { enableSymlinks?: boolean; useWatchman?: boolean }) {\n  if (opts.enableSymlinks && (opts.useWatchman ?? true)) {\n    throw new Error(\n      'enableSymlinks requires useWatchman:false — set watchman:false in config or CLI.'\n    );\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat enableSymlinks and useWatchman as mutually exclusive in your config validation.","In monorepos using pnpm/yarn workspaces (symlinks), always pass `--watchman=false`.","Add a config lint rule that flags `enableSymlinks: true` without `watchman: false`."],"tags":["configuration","symlinks","watchman","monorepo","validation"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}