Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Description

Adds documentation example showing how to use the context.config parameter in resolveSnapshotPath to access project-specific configuration (e.g., project name).

Resolves #9109

Example added:

import { join, dirname, basename } from 'node:path'
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    resolveSnapshotPath(testPath, snapExtension, context) {
      return join(
        dirname(testPath),
        '__snapshots__',
        context.config.name ?? 'default',
        basename(testPath) + snapExtension,
      )
    },
  },
})

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.

N/A - documentation only change. Verified with pnpm docs:build.

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:.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /usr/local/bin/node /usr/local/bin/node --require /home/REDACTED/work/vitest/vitest/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/vitest/vitest/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/loader.mjs .vitepress/scripts/fetch-avatars.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

context #9109
update code example in https://vitest.dev/config/resolvesnapshotpath.html to show context.config usage for project


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Nov 27, 2025

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 88f0f8d
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6928f7ab48083e000872633e
😎 Deploy Preview https://deploy-preview-9114--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.

Copilot AI changed the title [WIP] Update code example for context.config usage docs: update resolveSnapshotPath example to show context.config usage for projects Nov 27, 2025
Copilot AI requested a review from hi-ogawa November 27, 2025 09:17
Copilot finished work on behalf of hi-ogawa November 27, 2025 09:17
@hi-ogawa hi-ogawa marked this pull request as ready for review November 28, 2025 01:15
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.

feature request | per project resolveSnapshotPath

2 participants