@cldmv/vitest-runner 1.2.0 → 1.4.2
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.
- package/README.md +51 -11
- package/bin/vitest-runner.mjs +1549 -87
- package/dist/index.cjs +1389 -0
- package/dist/index.mjs +1335 -0
- package/package.json +31 -13
- package/types/src/bin/vitest-runner.d.mts +2 -0
- package/types/src/cli/args.d.mts +8 -0
- package/types/src/core/discover.d.mts +23 -0
- package/types/src/core/scratch.d.mts +64 -0
- package/types/src/core/spawn.d.mts +3 -1
- package/types/src/runner.d.mts +15 -0
- package/types/src/utils/ansi.d.mts +12 -0
- package/types/src/utils/duration.d.mts +12 -0
- package/types/src/utils/env.d.mts +12 -0
- package/index.cjs +0 -17
- package/index.mjs +0 -5
- package/src/cli/args.mjs +0 -148
- package/src/cli/help.mjs +0 -86
- package/src/core/discover.mjs +0 -167
- package/src/core/parse.mjs +0 -167
- package/src/core/progress.mjs +0 -164
- package/src/core/report.mjs +0 -255
- package/src/core/spawn.mjs +0 -219
- package/src/runner.mjs +0 -708
- package/src/utils/ansi.mjs +0 -32
- package/src/utils/duration.mjs +0 -25
- package/src/utils/env.mjs +0 -38
- package/src/utils/resolve.mjs +0 -86
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Sequential Vitest runner that spawns each test file in its own child process to
|
|
|
7
7
|
- Auto-detects your vitest config; accepts an explicit path if needed
|
|
8
8
|
- All standard Vitest CLI flags are forwarded unchanged
|
|
9
9
|
- Usable as a **CLI binary** or as a **programmatic Node.js API**
|
|
10
|
-
- Pure ESM
|
|
10
|
+
- Pure ESM source, bundled to a real CJS build for `require()` compatibility
|
|
11
11
|
|
|
12
12
|
[![npm version]][npm_version_url] [![npm downloads]][npm_downloads_url] <!-- [![GitHub release]][github_release_url] -->[![GitHub downloads]][github_downloads_url] [![Last commit]][last_commit_url] <!-- [![Release date]][release_date_url] -->[![npm last update]][npm_last_update_url] [![Coverage]][coverage_url]
|
|
13
13
|
|
|
@@ -15,6 +15,24 @@ Sequential Vitest runner that spawns each test file in its own child process to
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
+
## ✨ What's New
|
|
19
|
+
|
|
20
|
+
### Latest: v1.4.0 (September 2026)
|
|
21
|
+
|
|
22
|
+
- **A real build, and a CLI that finally works when installed** — `dist/` (library) and `bin/` (CLI) are now bundled with tsup instead of hand-written; a one-character npm packaging bug that silently stripped the `bin` field is fixed, so `vitest-runner` now works as an installed command for the first time.
|
|
23
|
+
- **Runner-owned scratch directories** — a per-run scratch root is created and cleaned up automatically, with a `makeRunTmpDir(label)` helper for test files instead of managing your own `mkdtemp` base.
|
|
24
|
+
- **CI/release automation completed** — the v4 staging-branch workflow set is now full (auto-merging the release PR on approval, `dependabot.yml`, and the rest), and every file header is normalized.
|
|
25
|
+
- [View full v1.4.0 Changelog](https://github.com/CLDMV/vitest-runner/blob/master/docs/changelog/v1/v1.4.0.md)
|
|
26
|
+
|
|
27
|
+
### Recent Releases
|
|
28
|
+
|
|
29
|
+
- **v1.3.3** (September 2026) — Dependency bump (`brace-expansion`, `postcss`) via Dependabot.
|
|
30
|
+
- **v1.3.2** (September 2026) — CI: pass `BOT_NAME`/`BOT_EMAIL` through to the v4 release/feature-PR workflows.
|
|
31
|
+
- **v1.3.0** (July 2026) — Onboarded onto the CLDMV v4 staging-branch release flow.
|
|
32
|
+
- **v1.2.0** (June 2026) — Added coverage `blobsDir` + `mergeReports` options.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
18
36
|
## Requirements
|
|
19
37
|
|
|
20
38
|
- Node.js ≥ 18
|
|
@@ -60,6 +78,8 @@ vitest-runner [OPTIONS] [PATTERNS...]
|
|
|
60
78
|
| `--json` | Print a JSON run report (no runner text output) |
|
|
61
79
|
| `--blobs-dir <path>` | Directory for per-file coverage blobs (default: `.vitest-coverage-blobs`, relative to `cwd`) |
|
|
62
80
|
| `--no-merge-reports` | Produce the coverage blobs but skip the merge and summary, leaving them in `--blobs-dir` for an external merge step |
|
|
81
|
+
| `--keep-tmp` | Keep this run's scratch directory instead of removing it on completion |
|
|
82
|
+
| `--scratch-dir <path>` | Per-run scratch root, relative to `cwd` (default: `tmp/vitest-runner`) |
|
|
63
83
|
| `--help`, `-h` | Print this help and exit |
|
|
64
84
|
|
|
65
85
|
### Test patterns
|
|
@@ -150,7 +170,7 @@ vitest-runner --json --no-top-summary
|
|
|
150
170
|
import { run } from "vitest-runner";
|
|
151
171
|
|
|
152
172
|
// CommonJS
|
|
153
|
-
const { run } =
|
|
173
|
+
const { run } = require("vitest-runner");
|
|
154
174
|
```
|
|
155
175
|
|
|
156
176
|
### `run(options)` → `Promise<number | object>`
|
|
@@ -193,6 +213,22 @@ process.exit(code);
|
|
|
193
213
|
| `perFileHeapOverrides` | `PerFileHeapOverride[]` | `[]` | Per-file minimum heap ceilings; the maximum of this and `maxOldSpaceMb` wins |
|
|
194
214
|
| `conditions` | `string[]` | `[]` | Additional `--conditions` Node flags forwarded to children |
|
|
195
215
|
| `nodeEnv` | `string` | `'development'` | Value written to `NODE_ENV` in child processes |
|
|
216
|
+
| `scratchDir` | `string` | `'tmp/vitest-runner'` | Per-run scratch root, relative to `cwd` (or absolute). A subdirectory is created per file invocation and exposed to it via `VITEST_RUNNER_TMP` |
|
|
217
|
+
| `keepTmp` | `boolean` | `false` | Keep the run's scratch root instead of removing it on completion (normal exit, failure, or SIGINT/SIGTERM) |
|
|
218
|
+
|
|
219
|
+
### Scratch directories (`VITEST_RUNNER_TMP` / `makeRunTmpDir`)
|
|
220
|
+
|
|
221
|
+
Every run gets its own scratch root (`<scratchDir>/<pid>-<timestamp>/`), created before any file runs and removed once the run completes — on success, on failure, and on SIGINT/SIGTERM — unless `keepTmp` is set. Each file invocation gets its own subdirectory under that root, exposed to the child as `process.env.VITEST_RUNNER_TMP`. Stale roots left by a crashed prior run (dead PID) are swept at the start of the next run.
|
|
222
|
+
|
|
223
|
+
From a test file, use `makeRunTmpDir(label)` to get a fresh, uniquely-named subdirectory instead of managing your own `mkdtemp` base:
|
|
224
|
+
|
|
225
|
+
```js
|
|
226
|
+
import { makeRunTmpDir } from "vitest-runner";
|
|
227
|
+
|
|
228
|
+
const dir = makeRunTmpDir("my-fixture"); // a fresh directory under VITEST_RUNNER_TMP
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
CLI flags: `--scratch-dir <path>` and `--keep-tmp` (see [Runner flags](#runner-flags) below).
|
|
196
232
|
|
|
197
233
|
#### `PerFileHeapOverride`
|
|
198
234
|
|
|
@@ -328,29 +364,33 @@ await run({ cwd, testDir: "src", testFilePattern: /\.spec\.ts$/i });
|
|
|
328
364
|
## Source layout
|
|
329
365
|
|
|
330
366
|
```text
|
|
331
|
-
|
|
332
|
-
index.
|
|
333
|
-
|
|
334
|
-
|
|
367
|
+
dist/ ← built library entry (npm run build / tsup) — generated, not committed
|
|
368
|
+
index.mjs ← bundled ESM entry
|
|
369
|
+
index.cjs ← bundled CJS entry (real sync require, generated from the same source)
|
|
370
|
+
bin/ ← built CLI binary (npm run build / tsup) — generated, not committed
|
|
371
|
+
vitest-runner.mjs ← bundled CLI, from src/bin/vitest-runner.mjs (shebang preserved)
|
|
335
372
|
src/
|
|
336
373
|
runner.mjs ← main run() API + re-exports
|
|
374
|
+
bin/
|
|
375
|
+
vitest-runner.mjs ← CLI entry SOURCE — run this directly for source-level dev/testing
|
|
337
376
|
utils/
|
|
338
377
|
ansi.mjs ← stripAnsi, colourPct
|
|
339
378
|
duration.mjs ← formatDuration
|
|
340
379
|
env.mjs ← buildNodeOptions
|
|
341
380
|
resolve.mjs ← resolveBin, resolveVitestConfig
|
|
342
381
|
core/
|
|
343
|
-
discover.mjs ← discoverVitestFiles, sortWithPriority
|
|
382
|
+
discover.mjs ← discoverVitestFiles, sortWithPriority, computeFilterConflicts
|
|
344
383
|
parse.mjs ← parseVitestOutput, deduplicateErrors
|
|
345
384
|
spawn.mjs ← runSingleFile, runVitestDirect, runMergeReports
|
|
346
385
|
report.mjs ← printCoverageSummary, printMergeOutput
|
|
347
386
|
progress.mjs ← createCoverageProgressTracker
|
|
387
|
+
scratch.mjs ← makeRunTmpDir + the scratch-directory lifecycle
|
|
348
388
|
cli/
|
|
349
389
|
args.mjs ← parseArguments
|
|
350
390
|
help.mjs ← showHelp
|
|
351
391
|
```
|
|
352
392
|
|
|
353
|
-
All sub-module utilities are re-exported from the root entry point, so deep imports are optional.
|
|
393
|
+
`src/` is not published — only `dist/`, `bin/`, and `types/` ship (see [Programmatic API](#programmatic-api) for the `vitest-runner-dev` export condition, used when developing against a workspace/local checkout instead of the published package). All sub-module utilities are re-exported from the root entry point, so deep imports are optional.
|
|
354
394
|
|
|
355
395
|
---
|
|
356
396
|
|
|
@@ -364,15 +404,15 @@ MIT
|
|
|
364
404
|
<!-- [release date]: https://img.shields.io/github/release-date/CLDMV/vitest-runner?style=for-the-badge&logo=github&logoColor=white&labelColor=181717 -->
|
|
365
405
|
<!-- [release_date_url]: https://github.com/CLDMV/vitest-runner/releases -->
|
|
366
406
|
|
|
367
|
-
[npm version]: https://img.shields.io/npm/v
|
|
407
|
+
[npm version]: https://img.shields.io/npm/v/%40cldmv%2Fvitest-runner.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
368
408
|
[npm_version_url]: https://www.npmjs.com/package/@cldmv/vitest-runner
|
|
369
|
-
[npm downloads]: https://img.shields.io/npm/dm
|
|
409
|
+
[npm downloads]: https://img.shields.io/npm/dm/%40cldmv%2Fvitest-runner.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
370
410
|
[npm_downloads_url]: https://www.npmjs.com/package/@cldmv/vitest-runner
|
|
371
411
|
[github downloads]: https://img.shields.io/github/downloads/CLDMV/vitest-runner/total?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
372
412
|
[github_downloads_url]: https://github.com/CLDMV/vitest-runner/releases
|
|
373
413
|
[last commit]: https://img.shields.io/github/last-commit/CLDMV/vitest-runner?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
374
414
|
[last_commit_url]: https://github.com/CLDMV/vitest-runner/commits
|
|
375
|
-
[npm last update]: https://img.shields.io/npm/last-update
|
|
415
|
+
[npm last update]: https://img.shields.io/npm/last-update/%40cldmv%2Fvitest-runner?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
376
416
|
[npm_last_update_url]: https://www.npmjs.com/package/@cldmv/vitest-runner
|
|
377
417
|
[coverage]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FCLDMV%2Fvitest-runner%2Fbadges%2Fcoverage.json&style=for-the-badge&logo=vitest&logoColor=white
|
|
378
418
|
[coverage_url]: https://github.com/CLDMV/vitest-runner/blob/badges/coverage.json
|