Skip to content

docs: replace /config/# hash links with direct page URLs#9599

Merged
sheremet-va merged 3 commits intovitest-dev:mainfrom
hi-ogawa:docs/fix-config-hash-links
Feb 7, 2026
Merged

docs: replace /config/# hash links with direct page URLs#9599
sheremet-va merged 3 commits intovitest-dev:mainfrom
hi-ogawa:docs/fix-config-hash-links

Conversation

@hi-ogawa
Copy link
Copy Markdown
Collaborator

@hi-ogawa hi-ogawa commented Feb 6, 2026

Description

I didn't think deeper and asked Claude.


Hash-based config links like /config/#reporters relied on a client-side
router hook to redirect to /config/reporters. This broke when opening
links in a new tab (Ctrl+Click) since the hook only runs on client-side
navigation, not on fresh page loads — causing hydration mismatches or
wrong content (#9593).

Applied via one-shot script (node fix-config-links.mjs from repo root):

import { readFileSync, writeFileSync } from 'fs'
import { execSync } from 'child_process'

const mapping = {
  '#alias': '/config/alias',
  '#attachmentsdir': '/config/attachmentsdir',
  '#bail': '/config/bail',
  '#clearmocks': '/config/clearmocks',
  '#coverage': '/config/coverage',
  '#dangerouslyignoreunhandlederrors': '/config/dangerouslyignoreunhandlederrors',
  '#environment': '/config/environment',
  '#environmentoptions': '/config/environmentoptions',
  '#fileparallelism': '/config/fileparallelism',
  '#fileParallelism': '/config/fileparallelism',
  '#forcereruntriggers': '/config/forcereruntriggers',
  '#globals': '/config/globals',
  '#globalsetup': '/config/globalsetup',
  '#include': '/config/include',
  '#includetasklocation': '/config/includetasklocation',
  '#isolate': '/config/isolate',
  '#maxconcurrency': '/config/maxconcurrency',
  '#maxworkers': '/config/maxworkers',
  '#mockreset': '/config/mockreset',
  '#name': '/config/name',
  '#onunhandlederror': '/config/onunhandlederror',
  '#outputfile': '/config/outputfile',
  '#passwithnotests': '/config/passwithnotests',
  '#pool': '/config/pool',
  '#provide': '/config/provide',
  '#reporters': '/config/reporters',
  '#restoremocks': '/config/restoremocks',
  '#restoreMocks': '/config/restoremocks',
  '#root': '/config/root',
  '#snapshotformat': '/config/snapshotformat',
  '#snapshotserializers': '/config/snapshotserializers',
  '#teardowntimeout': '/config/teardowntimeout',
  '#testnamepattern': '/config/testnamepattern',
  '#testtimeout': '/config/testtimeout',
  '#typecheck': '/config/typecheck',
  '#unstubenvs': '/config/unstubenvs',
  '#unstubglobals': '/config/unstubglobals',
  '#chaiconfig-truncatethreshold': '/config/chaiconfig#chaiconfig-truncatethreshold',
  '#coverage-clean': '/config/coverage#coverage-clean',
  '#coverage-exclude': '/config/coverage#coverage-exclude',
  '#coverage-experimentalastawareremapping': '/config/coverage#coverage-experimentalastawareremapping',
  '#coverage-include': '/config/coverage#coverage-include',
  '#coverage-reporter': '/config/coverage#coverage-reporter',
  '#deps-moduledirectories': '/config/deps#deps-moduledirectories',
  '#deps-optimizer-client': '/config/deps#deps-client',
  '#faketimers-looplimit': '/config/faketimers#faketimers-looplimit',
  '#sequence-concurrent': '/config/sequence#sequence-concurrent',
  '#sequence-hooks': '/config/sequence#sequence-hooks',
  '#sequence-shuffle': '/config/sequence#sequence-shuffle',
  '#typecheck-enabled': '/config/typecheck#typecheck-enabled',
  '#typecheck-ignoresourceerrors': '/config/typecheck#typecheck-ignoresourceerrors',
  '#typecheck-include': '/config/typecheck#typecheck-include',
  '#browser-api': '/config/browser/api',
  '#browser-viewport': '/config/browser/viewport',
  '#grouporder': '/config/sequence#sequence-grouporder',
  '#test-dir': '/config/dir',
  '#server-deps': '/config/server#deps',
  '#server-deps-inline': '/config/server#inline',
}

const files = execSync('find docs/ -name "*.md" -type f', { encoding: 'utf8' })
  .trim().split('\n')
let totalReplacements = 0
const unmapped = new Set()

for (const file of files) {
  let content = readFileSync(file, 'utf8')
  let modified = false
  const newContent = content.replace(/\/config\/(#[^)#\s]+)/g, (match, hash) => {
    const replacement = mapping[hash]
    if (replacement) { totalReplacements++; modified = true; return replacement }
    unmapped.add(hash)
    return match
  })
  if (modified) { writeFileSync(file, newContent); console.log('Updated: ' + file) }
}

console.log('\nTotal replacements: ' + totalReplacements)
if (unmapped.size > 0) console.log('Unmapped hashes:', [...unmapped])

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 6, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4acffa4
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6985bd48e18fbc00080ee821
😎 Deploy Preview https://deploy-preview-9599--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Hash-based config links like /config/#reporters relied on a client-side
router hook to redirect to /config/reporters. This broke when opening
links in a new tab (Ctrl+Click) since the hook only runs on client-side
navigation, not on fresh page loads — causing hydration mismatches or
wrong content (vitest-dev#9593).

Applied via one-shot script (node fix-config-links.mjs from repo root):

```js
import { readFileSync, writeFileSync } from 'fs'
import { execSync } from 'child_process'

const mapping = {
  '#alias': '/config/alias',
  '#attachmentsdir': '/config/attachmentsdir',
  '#bail': '/config/bail',
  '#clearmocks': '/config/clearmocks',
  '#coverage': '/config/coverage',
  '#dangerouslyignoreunhandlederrors': '/config/dangerouslyignoreunhandlederrors',
  '#environment': '/config/environment',
  '#environmentoptions': '/config/environmentoptions',
  '#fileparallelism': '/config/fileparallelism',
  '#fileParallelism': '/config/fileparallelism',
  '#forcereruntriggers': '/config/forcereruntriggers',
  '#globals': '/config/globals',
  '#globalsetup': '/config/globalsetup',
  '#include': '/config/include',
  '#includetasklocation': '/config/includetasklocation',
  '#isolate': '/config/isolate',
  '#maxconcurrency': '/config/maxconcurrency',
  '#maxworkers': '/config/maxworkers',
  '#mockreset': '/config/mockreset',
  '#name': '/config/name',
  '#onunhandlederror': '/config/onunhandlederror',
  '#outputfile': '/config/outputfile',
  '#passwithnotests': '/config/passwithnotests',
  '#pool': '/config/pool',
  '#provide': '/config/provide',
  '#reporters': '/config/reporters',
  '#restoremocks': '/config/restoremocks',
  '#restoreMocks': '/config/restoremocks',
  '#root': '/config/root',
  '#snapshotformat': '/config/snapshotformat',
  '#snapshotserializers': '/config/snapshotserializers',
  '#teardowntimeout': '/config/teardowntimeout',
  '#testnamepattern': '/config/testnamepattern',
  '#testtimeout': '/config/testtimeout',
  '#typecheck': '/config/typecheck',
  '#unstubenvs': '/config/unstubenvs',
  '#unstubglobals': '/config/unstubglobals',
  '#chaiconfig-truncatethreshold': '/config/chaiconfig#chaiconfig-truncatethreshold',
  '#coverage-clean': '/config/coverage#coverage-clean',
  '#coverage-exclude': '/config/coverage#coverage-exclude',
  '#coverage-experimentalastawareremapping': '/config/coverage#coverage-experimentalastawareremapping',
  '#coverage-include': '/config/coverage#coverage-include',
  '#coverage-reporter': '/config/coverage#coverage-reporter',
  '#deps-moduledirectories': '/config/deps#deps-moduledirectories',
  '#deps-optimizer-client': '/config/deps#deps-client',
  '#faketimers-looplimit': '/config/faketimers#faketimers-looplimit',
  '#sequence-concurrent': '/config/sequence#sequence-concurrent',
  '#sequence-hooks': '/config/sequence#sequence-hooks',
  '#sequence-shuffle': '/config/sequence#sequence-shuffle',
  '#typecheck-enabled': '/config/typecheck#typecheck-enabled',
  '#typecheck-ignoresourceerrors': '/config/typecheck#typecheck-ignoresourceerrors',
  '#typecheck-include': '/config/typecheck#typecheck-include',
  '#browser-api': '/config/browser/api',
  '#browser-viewport': '/config/browser/viewport',
  '#grouporder': '/config/sequence#sequence-grouporder',
  '#test-dir': '/config/dir',
  '#server-deps': '/config/server#deps',
  '#server-deps-inline': '/config/server#inline',
}

const files = execSync('find docs/ -name "*.md" -type f', { encoding: 'utf8' })
  .trim().split('\n')
let totalReplacements = 0
const unmapped = new Set()

for (const file of files) {
  let content = readFileSync(file, 'utf8')
  let modified = false
  const newContent = content.replace(/\/config\/(#[^)#\s]+)/g, (match, hash) => {
    const replacement = mapping[hash]
    if (replacement) { totalReplacements++; modified = true; return replacement }
    unmapped.add(hash)
    return match
  })
  if (modified) { writeFileSync(file, newContent); console.log('Updated: ' + file) }
}

console.log('\nTotal replacements: ' + totalReplacements)
if (unmapped.size > 0) console.log('Unmapped hashes:', [...unmapped])
```

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hi-ogawa hi-ogawa marked this pull request as ready for review February 6, 2026 10:10
@sheremet-va sheremet-va merged commit 32a2d71 into vitest-dev:main Feb 7, 2026
16 checks passed
@hi-ogawa hi-ogawa deleted the docs/fix-config-hash-links branch February 8, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants