Skip to content

Commit

Permalink
fix: export types
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 29, 2024
1 parent 8014420 commit bb40570
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@ A list of paths to snapshot serializer modules for snapshot testing, useful if y

### resolveSnapshotPath<NonProjectOption />

- **Type**: `(testPath: string, snapExtension: string) => string`
- **Type**: `(testPath: string, snapExtension: string, context: { config: SerializedConfig }) => string`
- **Default**: stores snapshot files in `__snapshots__` directory

Overrides default snapshot path. For example, to store snapshots next to test files:
Expand Down
8 changes: 3 additions & 5 deletions packages/vitest/src/node/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ type ReporterWithOptions<Name extends ReporterName = ReporterName> =
: [Name, Partial<BuiltinReporterOptions[Name]>]
: [Name, Record<string, unknown>]

export type ResolveSnapshotPathHandler = (testPath: string, snapExtension: string, context: { config: SerializedConfig }) => string

export interface InlineConfig {
/**
* Name of the project. Will be used to display in the reporter.
Expand Down Expand Up @@ -574,11 +576,7 @@ export interface InlineConfig {
/**
* Resolve custom snapshot path
*/
resolveSnapshotPath?: (
path: string,
extension: string,
context: { config: SerializedConfig }
) => string
resolveSnapshotPath?: ResolveSnapshotPathHandler

/**
* Path to a custom snapshot environment module that has a default export of `SnapshotEnvironment` object.
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/public/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export type {
ProjectConfig,
ResolvedConfig,
ResolvedProjectConfig,
ResolveSnapshotPathHandler,
RuntimeConfig,
SequenceHooks,
SequenceSetupFiles,
Expand Down

0 comments on commit bb40570

Please sign in to comment.