vitest-runner 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Parse raw CLI arguments into structured runner options.
3
+ *
4
+ * Runner-specific flags are extracted; everything else (flags and their
5
+ * optional values) is forwarded to vitest as passthrough args.
6
+ * A flag that takes a value (where the next token does not start with `-`)
7
+ * consumes that token too.
8
+ *
9
+ * @param {string[]} args - Raw argument array (typically `process.argv.slice(2)`).
10
+ * @returns {ParsedArgs}
11
+ * @example
12
+ * parseArguments(['--test-list', 'tests.json', '--workers', '2', '--reporter=verbose']);
13
+ */
14
+ export function parseArguments(args: string[]): ParsedArgs;
15
+ export type ParsedArgs = {
16
+ /**
17
+ * - Path to a JSON file of test paths to run (`--test-list`).
18
+ */
19
+ testListFile: string | undefined;
20
+ /**
21
+ * - `false` when `--no-error-details` was passed.
22
+ */
23
+ showErrorDetails: boolean;
24
+ /**
25
+ * - Whether `--coverage-quiet` was passed.
26
+ */
27
+ coverageQuiet: boolean;
28
+ /**
29
+ * - Path for the coverage run log (`--log-file`); defaults to `coverage/coverage-run.log`.
30
+ */
31
+ logFile: string | undefined;
32
+ /**
33
+ * - Whether `--help` / `-h` was passed.
34
+ */
35
+ help: boolean;
36
+ /**
37
+ * - Worker count from `--workers <n>`, or undefined.
38
+ */
39
+ workers: number | undefined;
40
+ /**
41
+ * - Path substrings from `--solo-pattern <pattern>` (repeatable).
42
+ */
43
+ soloPatterns: string[];
44
+ /**
45
+ * - Compiled regex from `--file-pattern <regex>`, or undefined.
46
+ */
47
+ testFilePattern: RegExp | undefined;
48
+ /**
49
+ * - Flags forwarded verbatim to vitest.
50
+ */
51
+ vitestPassthroughArgs: string[];
52
+ /**
53
+ * - Non-flag positional arguments (file / folder patterns).
54
+ */
55
+ testPatterns: string[];
56
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Print the full CLI help message to stdout.
3
+ * @returns {void}
4
+ * @example
5
+ * showHelp();
6
+ */
7
+ export function showHelp(): void;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Recursively discover all Vitest test files under a directory.
3
+ * Skips `node_modules` and hidden directories (names starting with `.`).
4
+ *
5
+ * @param {string} dir - Absolute path of the directory to scan.
6
+ * @param {string} cwd - Project root used to compute relative paths.
7
+ * @param {RegExp} [pattern=DEFAULT_TEST_FILE_PATTERN] - Regex tested against the file name.
8
+ * @returns {Promise<string[]>} Paths relative to `cwd`.
9
+ * @example
10
+ * const files = await discoverFilesInDir('/project/src/tests', '/project');
11
+ */
12
+ export function discoverFilesInDir(dir: string, cwd: string, pattern?: RegExp): Promise<string[]>;
13
+ /**
14
+ * Sort test files alphabetically while hoisting files matching `earlyRunPatterns`
15
+ * to the front (in pattern-declaration order, then alphabetically within each group).
16
+ *
17
+ * @param {string[]} files - File paths to sort.
18
+ * @param {string[]} [earlyRunPatterns=[]] - Substrings — files whose path contains one run first.
19
+ * @returns {string[]} Sorted file paths.
20
+ * @example
21
+ * sortWithPriority(files, ['listener-cleanup/']);
22
+ */
23
+ export function sortWithPriority(files: string[], earlyRunPatterns?: string[]): string[];
24
+ /**
25
+ * @typedef {Object} DiscoverOptions
26
+ * @property {string} cwd - Project root directory.
27
+ * @property {string} [testDir] - Root directory to search for test files (defaults to `cwd`).
28
+ * @property {string[]} [testPatterns=[]] - File / folder patterns to filter (empty = all files).
29
+ * @property {string} [testListFile] - Path to a JSON array of test file paths to run instead of scanning.
30
+ * @property {RegExp} [testFilePattern] - Regex to match file names (default: `DEFAULT_TEST_FILE_PATTERN`).
31
+ * @property {string[]} [earlyRunPatterns=[]] - Path substrings for files that must run solo first.
32
+ */
33
+ /**
34
+ * Discover Vitest test files according to the provided options.
35
+ *
36
+ * | Scenario | Behaviour |
37
+ * |---|---|
38
+ * | `testListFile` set | Reads the exact file list from that JSON file. |
39
+ * | Patterns provided | Resolves each as file / directory, falls back to partial-path match. |
40
+ * | No patterns | Returns all test files found under `testDir`. |
41
+ *
42
+ * @param {DiscoverOptions} opts
43
+ * @returns {Promise<string[]>} Sorted array of test file paths relative to `cwd`.
44
+ * @example
45
+ * const files = await discoverVitestFiles({ cwd: '/project', testDir: '/project/src/tests' });
46
+ */
47
+ export function discoverVitestFiles(opts: DiscoverOptions): Promise<string[]>;
48
+ /** Default pattern matching all supported Vitest test file extensions. */
49
+ export const DEFAULT_TEST_FILE_PATTERN: RegExp;
50
+ export type DiscoverOptions = {
51
+ /**
52
+ * - Project root directory.
53
+ */
54
+ cwd: string;
55
+ /**
56
+ * - Root directory to search for test files (defaults to `cwd`).
57
+ */
58
+ testDir?: string;
59
+ /**
60
+ * - File / folder patterns to filter (empty = all files).
61
+ */
62
+ testPatterns?: string[];
63
+ /**
64
+ * - Path to a JSON array of test file paths to run instead of scanning.
65
+ */
66
+ testListFile?: string;
67
+ /**
68
+ * - Regex to match file names (default: `DEFAULT_TEST_FILE_PATTERN`).
69
+ */
70
+ testFilePattern?: RegExp;
71
+ /**
72
+ * - Path substrings for files that must run solo first.
73
+ */
74
+ earlyRunPatterns?: string[];
75
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @typedef {Object} ParsedVitestResult
3
+ * @property {number} testFilesPass - Number of test files that passed.
4
+ * @property {number} testFilesFail - Number of test files that failed.
5
+ * @property {number} testsPass - Number of individual tests that passed.
6
+ * @property {number} testsFail - Number of individual tests that failed.
7
+ * @property {number} testsSkip - Number of individual tests that were skipped.
8
+ * @property {number} duration - Duration in milliseconds (from Vitest output).
9
+ * @property {number|null} heapMb - Peak heap usage in MB, or `null` if not reported.
10
+ * @property {string[]} errors - Array of raw error blocks (with ANSI codes).
11
+ */
12
+ /**
13
+ * Parse raw Vitest stdout/stderr output into structured result data.
14
+ *
15
+ * Extracts test-file counts, individual test counts, duration, heap usage,
16
+ * and error blocks. Counts are parsed from ANSI-stripped output; error blocks
17
+ * are captured from the original coloured output.
18
+ *
19
+ * @param {string} output - Combined raw stdout + stderr from a vitest child process.
20
+ * @returns {ParsedVitestResult}
21
+ * @example
22
+ * const result = parseVitestOutput(rawOutput);
23
+ * console.log(result.testsPass, result.testsFail);
24
+ */
25
+ export function parseVitestOutput(output: string): ParsedVitestResult;
26
+ /**
27
+ * Deduplicate similar FAIL lines that differ only by their `Config:` value.
28
+ *
29
+ * When the same test file fails across multiple matrix configs vitest emits
30
+ * one FAIL line per config. This collapses them into a single line listing
31
+ * all configs as an array, keeping output concise.
32
+ *
33
+ * @param {string[]} errors - Array of raw error blocks (each a complete FAIL section).
34
+ * @returns {string} Deduplicated error text joined as a single string.
35
+ * @example
36
+ * const deduped = deduplicateErrors(result.errors);
37
+ * console.log(deduped);
38
+ */
39
+ export function deduplicateErrors(errors: string[]): string;
40
+ export type ParsedVitestResult = {
41
+ /**
42
+ * - Number of test files that passed.
43
+ */
44
+ testFilesPass: number;
45
+ /**
46
+ * - Number of test files that failed.
47
+ */
48
+ testFilesFail: number;
49
+ /**
50
+ * - Number of individual tests that passed.
51
+ */
52
+ testsPass: number;
53
+ /**
54
+ * - Number of individual tests that failed.
55
+ */
56
+ testsFail: number;
57
+ /**
58
+ * - Number of individual tests that were skipped.
59
+ */
60
+ testsSkip: number;
61
+ /**
62
+ * - Duration in milliseconds (from Vitest output).
63
+ */
64
+ duration: number;
65
+ /**
66
+ * - Peak heap usage in MB, or `null` if not reported.
67
+ */
68
+ heapMb: number | null;
69
+ /**
70
+ * - Array of raw error blocks (with ANSI codes).
71
+ */
72
+ errors: string[];
73
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Create a live progress tracker that renders to stdout.
3
+ *
4
+ * In TTY mode a spinner + bar overwrites the current line on each update.
5
+ * In non-TTY mode a plain-text line is printed at most once every two seconds,
6
+ * plus once on every `onComplete` call.
7
+ *
8
+ * @param {number} total - Total number of files to process.
9
+ * @returns {{ onStart: () => void, onComplete: (failedRun: boolean) => void, finish: () => void }}
10
+ * @example
11
+ * const progress = createCoverageProgressTracker(120);
12
+ * progress.onStart();
13
+ * progress.onComplete(false);
14
+ * progress.finish();
15
+ */
16
+ export function createCoverageProgressTracker(total: number): {
17
+ onStart: () => void;
18
+ onComplete: (failedRun: boolean) => void;
19
+ finish: () => void;
20
+ };
21
+ /**
22
+ * A no-op progress tracker used when quiet mode is disabled (progress is
23
+ * handled via `console.log` inline).
24
+ * @type {{ onStart: () => void, onComplete: (failedRun: boolean) => void, finish: () => void }}
25
+ */
26
+ export const noopProgressTracker: {
27
+ onStart: () => void;
28
+ onComplete: (failedRun: boolean) => void;
29
+ finish: () => void;
30
+ };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Print verbose output for files that failed during a quiet coverage run.
3
+ *
4
+ * @param {Array<{file: string, code: number, rawOutput: string}>} failedResults
5
+ * @returns {void}
6
+ * @example
7
+ * printQuietCoverageFailureDetails(failedResults);
8
+ */
9
+ export function printQuietCoverageFailureDetails(failedResults: Array<{
10
+ file: string;
11
+ code: number;
12
+ rawOutput: string;
13
+ }>): void;
14
+ /**
15
+ * Print the captured output from a quiet `--mergeReports` step.
16
+ *
17
+ * On success prints only the coverage block (from "% Coverage report from v8").
18
+ * On failure prints the full raw output to stderr.
19
+ *
20
+ * @param {number} exitCode - The merge process exit code.
21
+ * @param {string} output - Raw stdout + stderr from the merge process.
22
+ * @returns {void}
23
+ */
24
+ export function printMergeOutput(exitCode: number, output: string): void;
25
+ /**
26
+ * Compute a coverage-summary-style object from a raw V8/Istanbul `coverage-final.json`.
27
+ *
28
+ * @param {Record<string, object>} finalData - Parsed `coverage-final.json` contents.
29
+ * @returns {{ total: object, [filePath: string]: object }} Istanbul coverage-summary format.
30
+ */
31
+ export function computeSummaryFromFinal(finalData: Record<string, object>): {
32
+ total: object;
33
+ [filePath: string]: object;
34
+ };
35
+ /**
36
+ * Read the coverage JSON produced after a `mergeReports` run and print a
37
+ * worst-offenders table plus overall-coverage totals.
38
+ *
39
+ * Tries `coverage-summary.json` first; falls back to computing from
40
+ * `coverage-final.json` if that is not present.
41
+ *
42
+ * @param {string} cwd - Project root (used to make absolute file paths relative).
43
+ * @param {string[]} extraCoverageArgs - Passthrough `--coverage.*` args (checked for `reportsDirectory`).
44
+ * @param {number} [worstCount=10] - Number of worst-coverage files to show (0 = skip table).
45
+ * @returns {Promise<void>}
46
+ */
47
+ export function printCoverageSummary(cwd: string, extraCoverageArgs: string[], worstCount?: number): Promise<void>;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @typedef {Object} SingleFileResult
3
+ * @property {string} file - Test file path.
4
+ * @property {number} code - Process exit code.
5
+ * @property {number} duration - Run duration in milliseconds.
6
+ * @property {number} testFilesPass
7
+ * @property {number} testFilesFail
8
+ * @property {number} testsPass
9
+ * @property {number} testsFail
10
+ * @property {number} testsSkip
11
+ * @property {number|null} heapMb
12
+ * @property {string[]} errors
13
+ * @property {string} rawOutput
14
+ */
15
+ /**
16
+ * Run a single Vitest test file in a child process and return parsed results.
17
+ *
18
+ * @param {string} filePath - Test file path (relative to `cwd` or absolute).
19
+ * @param {SpawnBaseOptions & { vitestArgs?: string[], streamOutput?: boolean }} opts
20
+ * @returns {Promise<SingleFileResult>}
21
+ * @example
22
+ * const result = await runSingleFile('src/tests/foo.test.vitest.mjs', {
23
+ * cwd: '/project',
24
+ * vitestBin: '/project/node_modules/.bin/vitest',
25
+ * vitestConfig: '/project/vitest.config.ts',
26
+ * });
27
+ */
28
+ export function runSingleFile(filePath: string, opts: SpawnBaseOptions & {
29
+ vitestArgs?: string[];
30
+ streamOutput?: boolean;
31
+ }): Promise<SingleFileResult>;
32
+ /**
33
+ * Run Vitest directly (all files in one process) with inherited stdio.
34
+ *
35
+ * @param {SpawnBaseOptions & { vitestArgs?: string[] }} opts
36
+ * @returns {Promise<number>} Process exit code.
37
+ * @example
38
+ * const code = await runVitestDirect({
39
+ * cwd: '/project',
40
+ * vitestBin: '/project/node_modules/.bin/vitest',
41
+ * vitestArgs: ['--reporter=verbose'],
42
+ * });
43
+ */
44
+ export function runVitestDirect(opts: SpawnBaseOptions & {
45
+ vitestArgs?: string[];
46
+ }): Promise<number>;
47
+ /**
48
+ * Merge blob reports from individual coverage runs into a single coverage report
49
+ * using `vitest --mergeReports`.
50
+ *
51
+ * @param {string} blobsDir - Directory containing the `.blob` files to merge.
52
+ * @param {SpawnBaseOptions & { extraCoverageArgs?: string[], quietOutput?: boolean }} opts
53
+ * @returns {Promise<{ exitCode: number, output: string }>}
54
+ * @example
55
+ * const { exitCode } = await runMergeReports('/project/.vitest-blobs', {
56
+ * cwd: '/project',
57
+ * vitestBin: '/project/node_modules/.bin/vitest',
58
+ * });
59
+ */
60
+ export function runMergeReports(blobsDir: string, opts: SpawnBaseOptions & {
61
+ extraCoverageArgs?: string[];
62
+ quietOutput?: boolean;
63
+ }): Promise<{
64
+ exitCode: number;
65
+ output: string;
66
+ }>;
67
+ export type SpawnBaseOptions = {
68
+ /**
69
+ * - Working directory for the child process.
70
+ */
71
+ cwd: string;
72
+ /**
73
+ * - Absolute path to the vitest binary.
74
+ */
75
+ vitestBin: string;
76
+ /**
77
+ * - Vitest config path (omit to let vitest auto-detect).
78
+ */
79
+ vitestConfig: string | undefined;
80
+ /**
81
+ * - Optional `--max-old-space-size` ceiling.
82
+ */
83
+ maxOldSpaceMb: number | undefined;
84
+ /**
85
+ * - Additional `--conditions` flags.
86
+ */
87
+ conditions?: string[];
88
+ /**
89
+ * - Value for `NODE_ENV`.
90
+ */
91
+ nodeEnv?: string;
92
+ };
93
+ export type SingleFileResult = {
94
+ /**
95
+ * - Test file path.
96
+ */
97
+ file: string;
98
+ /**
99
+ * - Process exit code.
100
+ */
101
+ code: number;
102
+ /**
103
+ * - Run duration in milliseconds.
104
+ */
105
+ duration: number;
106
+ testFilesPass: number;
107
+ testFilesFail: number;
108
+ testsPass: number;
109
+ testsFail: number;
110
+ testsSkip: number;
111
+ heapMb: number | null;
112
+ errors: string[];
113
+ rawOutput: string;
114
+ };
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Run all discovered Vitest test files sequentially (with a configurable worker
3
+ * pool for the non-solo phase) and return an exit code.
4
+ *
5
+ * @param {RunOptions} opts
6
+ * @returns {Promise<number>} `0` on full pass, `1` on any failure.
7
+ */
8
+ export function run(opts: RunOptions): Promise<number>;
9
+ export { formatDuration } from "./utils/duration.mjs";
10
+ export { buildNodeOptions } from "./utils/env.mjs";
11
+ export type PerFileHeapOverride = {
12
+ /**
13
+ * - Substring matched against the normalised file path.
14
+ */
15
+ pattern: string;
16
+ /**
17
+ * - Minimum heap ceiling in MB for matching files.
18
+ */
19
+ heapMb: number;
20
+ };
21
+ export type RunOptions = {
22
+ /**
23
+ * - Absolute project root directory.
24
+ */
25
+ cwd: string;
26
+ /**
27
+ * - Directory to scan for test files (relative or absolute; defaults to `cwd`).
28
+ */
29
+ testDir?: string;
30
+ /**
31
+ * - Explicit vitest config path; auto-detected from `cwd` when omitted.
32
+ */
33
+ vitestConfig?: string;
34
+ /**
35
+ * - File / folder patterns to filter (empty = all files in `testDir`).
36
+ */
37
+ testPatterns?: string[];
38
+ /**
39
+ * - Path to a JSON array of test file paths; when set, scanning is skipped.
40
+ */
41
+ testListFile?: string;
42
+ /**
43
+ * - Regex matched against file names when scanning (default: `*.test.vitest.{js,mjs,cjs}`).
44
+ */
45
+ testFilePattern?: RegExp;
46
+ /**
47
+ * - Extra CLI args forwarded verbatim to every vitest invocation.
48
+ */
49
+ vitestArgs?: string[];
50
+ /**
51
+ * - Print inline error blocks under each failed file.
52
+ */
53
+ showErrorDetails?: boolean;
54
+ /**
55
+ * - Suppress per-file output; show only progress bar + summaries.
56
+ */
57
+ coverageQuiet?: boolean;
58
+ /**
59
+ * - Maximum number of parallel worker slots.
60
+ */
61
+ workers?: number;
62
+ /**
63
+ * - Rows in the worst-coverage table (0 = disable).
64
+ */
65
+ worstCoverageCount?: number;
66
+ /**
67
+ * - Global `--max-old-space-size` ceiling; per-file overrides may raise it.
68
+ */
69
+ maxOldSpaceMb?: number;
70
+ /**
71
+ * - Path substrings — matching files run solo before the worker pool.
72
+ */
73
+ earlyRunPatterns?: string[];
74
+ /**
75
+ * - Per-file minimum heap overrides.
76
+ */
77
+ perFileHeapOverrides?: PerFileHeapOverride[];
78
+ /**
79
+ * - Additional `--conditions` Node flags forwarded to children.
80
+ */
81
+ conditions?: string[];
82
+ /**
83
+ * - Value for `NODE_ENV` in child processes.
84
+ */
85
+ nodeEnv?: string;
86
+ /**
87
+ * -
88
+ */
89
+ _testResultsOverride?: object[] | null;
90
+ };
91
+ export { resolveBin, resolveVitestConfig } from "./utils/resolve.mjs";
92
+ export { discoverVitestFiles, sortWithPriority, discoverFilesInDir } from "./core/discover.mjs";
93
+ export { parseVitestOutput, deduplicateErrors } from "./core/parse.mjs";
94
+ export { runSingleFile, runVitestDirect, runMergeReports } from "./core/spawn.mjs";
95
+ export { createCoverageProgressTracker, noopProgressTracker } from "./core/progress.mjs";
96
+ export { printCoverageSummary, printMergeOutput, printQuietCoverageFailureDetails } from "./core/report.mjs";
97
+ export { stripAnsi, colourPct } from "./utils/ansi.mjs";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview ANSI escape-code helpers.
3
+ * @module vitest-runner/src/utils/ansi
4
+ */
5
+ /**
6
+ * Strip ANSI colour/style escape codes from a string.
7
+ * @param {string} text - Input text that may contain ANSI codes.
8
+ * @returns {string} Clean text without escape codes.
9
+ * @example
10
+ * stripAnsi('\x1B[32mhello\x1B[0m'); // 'hello'
11
+ */
12
+ export function stripAnsi(text: string): string;
13
+ /**
14
+ * Colour-code a coverage percentage value using chalk.
15
+ * ≥ 80 % → green, ≥ 50 % → yellow, < 50 % → red.
16
+ * @param {import('chalk').ChalkInstance} chalk - Chalk instance supplied by the caller.
17
+ * @param {number} pct - Coverage percentage 0–100.
18
+ * @returns {string} Chalk-coloured, right-aligned percentage string.
19
+ * @example
20
+ * colourPct(chalk, 75.5); // yellow ' 75.50'
21
+ */
22
+ export function colourPct(chalk: import("chalk").ChalkInstance, pct: number): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Duration formatting utilities.
3
+ * @module vitest-runner/src/utils/duration
4
+ */
5
+ /**
6
+ * Format a millisecond duration as a human-readable `m:ss` or `h:mm:ss` string.
7
+ * @param {number} ms - Duration in milliseconds.
8
+ * @returns {string} Formatted duration string.
9
+ * @example
10
+ * formatDuration(65000); // '1:05'
11
+ * formatDuration(3661000); // '1:01:01'
12
+ */
13
+ export function formatDuration(ms: number): string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview NODE_OPTIONS / environment helpers.
3
+ * @module vitest-runner/src/utils/env
4
+ */
5
+ /**
6
+ * Build a `NODE_OPTIONS` string suitable for passing to child vitest processes.
7
+ *
8
+ * Merges any existing base value with optional `--max-old-space-size` and
9
+ * `--conditions` flags. Each flag is only added once even if called multiple
10
+ * times with the same value.
11
+ *
12
+ * @param {Object} opts
13
+ * @param {number|undefined} opts.maxOldSpaceMb - Heap ceiling to add (omit or `undefined` to skip).
14
+ * @param {string[]} [opts.conditions=[]] - Additional `--conditions` values to append.
15
+ * @param {string} [opts.base] - Starting `NODE_OPTIONS` string; defaults to `process.env.NODE_OPTIONS`.
16
+ * @returns {string} Combined `NODE_OPTIONS` string (trimmed).
17
+ * @example
18
+ * buildNodeOptions({ maxOldSpaceMb: 4096, conditions: ['my-dev'] });
19
+ * // '--conditions=my-dev --max-old-space-size=4096'
20
+ */
21
+ export function buildNodeOptions({ maxOldSpaceMb, conditions, base }: {
22
+ maxOldSpaceMb: number | undefined;
23
+ conditions?: string[];
24
+ base?: string;
25
+ }): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Resolve the absolute path of a binary shipped with an npm package.
3
+ *
4
+ * The `require` instance is rooted at `cwd` so the package is found in the
5
+ * consumer project's `node_modules`, not the runner's own.
6
+ *
7
+ * @param {string} cwd - Consumer project root to search from.
8
+ * @param {string} pkgName - The npm package name (e.g. `'vitest'`).
9
+ * @param {string} [binName=pkgName] - The bin alias key to look up.
10
+ * @returns {string} Absolute path to the binary entry point.
11
+ * @throws {Error} When the bin entry is not found in the package manifest.
12
+ * @example
13
+ * resolveBin('/my/project', 'vitest');
14
+ * // '/my/project/node_modules/vitest/dist/cli.mjs'
15
+ */
16
+ export function resolveBin(cwd: string, pkgName: string, binName?: string): string;
17
+ /**
18
+ * Resolve the vitest config path to use for a project.
19
+ *
20
+ * - If `configPath` is provided it is returned as-is (resolved absolute if relative).
21
+ * - Otherwise the function walks {@link DEFAULT_CONFIG_NAMES} relative to `cwd`
22
+ * and returns the first file that exists.
23
+ * - Returns `undefined` when nothing is found, letting vitest use its own defaults.
24
+ *
25
+ * @param {string} cwd - Project root directory.
26
+ * @param {string|undefined} configPath - Explicit config path, or `undefined` for auto-detect.
27
+ * @returns {Promise<string|undefined>} Resolved absolute config path, or `undefined`.
28
+ * @example
29
+ * const cfg = await resolveVitestConfig('/my/project', undefined);
30
+ * // '/my/project/vitest.config.ts' (if that file exists)
31
+ */
32
+ export function resolveVitestConfig(cwd: string, configPath: string | undefined): Promise<string | undefined>;