Skip to content

fix(reporters): handle concurrent createReport calls - #11278

Merged
hi-ogawa merged 1 commit into
vitest-dev:mainfrom
7rulnik:fix/concurrent-report-directory
Sep 17, 2026
Merged

hi-ogawa merged 1 commit into
vitest-dev:mainfrom
7rulnik:fix/concurrent-report-directory

Conversation

@7rulnik

@7rulnik 7rulnik commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

Concurrent Vitest processes sharing a fresh report directory can both pass the existsSync() check in createReport(). One then fails with EEXIST when creating .vitest or its scoped directory. With the default blob reporter, this can leave a shard without a report even when its tests passed. The blob reporter started using this helper in #10232.

This PR replaces the separate existence checks and directory creation calls with mkdirSync(reportDir, { recursive: true }), which creates the parent directory and tolerates directories created by another process.

Basically it's a rare race condition.

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

netlify Bot commented Sep 15, 2026

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9c7406f
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6aa968350a2d3400086b38c1
😎 Deploy Preview https://deploy-preview-11278--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@hi-ogawa hi-ogawa changed the title fix(reporters): handle concurrent report creation fix(reporters): handle concurrent createReport calls Sep 17, 2026
@hi-ogawa
hi-ogawa merged commit e8e556f into vitest-dev:main Sep 17, 2026
29 of 30 checks passed
dadezzz pushed a commit to dadezzz/forgejo-agent that referenced this pull request Sep 30, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [vitest](https://vitest.dev) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | [`5.0.1` → `5.0.2`](https://renovatebot.com/diffs/npm/vitest/5.0.1/5.0.2) | ![age](https://developer.mend.io/api/mc/badges/age/npm/vitest/5.0.2?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vitest/5.0.1/5.0.2?slim=true) |

---

### Release Notes

<details>
<summary>vitest-dev/vitest (vitest)</summary>

### [`v5.0.2`](https://github.com/vitest-dev/vitest/releases/tag/v5.0.2)

[Compare Source](vitest-dev/vitest@v5.0.1...v5.0.2)

#####    🐞 Bug Fixes

- Bind `process` in case global is overwritten  -  by [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in [#&#8203;11343](vitest-dev/vitest#11343) [<samp>(0b792)</samp>](vitest-dev/vitest@0b79231ad)
- **detect-async-leaks**:
  - Ignore `process.stdio` handles  -  by [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in [#&#8203;11333](vitest-dev/vitest#11333) [<samp>(0fd6b)</samp>](vitest-dev/vitest@0fd6b9790)
- **expect**:
  - Fix `toMatchObject` with asymmetric matchers  -  by [@&#8203;ShreeBohara](https://github.com/ShreeBohara), **Claude Opus 5**, [@&#8203;hi-ogawa](https://github.com/hi-ogawa), **Hiroshi Ogawa** and **Codex (GPT-5)** in [#&#8203;11100](vitest-dev/vitest#11100) [<samp>(42523)</samp>](vitest-dev/vitest@42523289e)
- **jsdom**:
  - Fix `Request` with `Blob` body on jsdom 28+  -  by [@&#8203;harshit-d3v](https://github.com/harshit-d3v) in [#&#8203;11295](vitest-dev/vitest#11295) [<samp>(d1c3e)</samp>](vitest-dev/vitest@d1c3ecc93)
- **reporter**:
  - `agent` to respect `--silent`  -  by [@&#8203;Raj4478](https://github.com/Raj4478) and [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in [#&#8203;11271](vitest-dev/vitest#11271) [<samp>(5b95e)</samp>](vitest-dev/vitest@5b95efb6d)
- **reporters**:
  - Handle concurrent `createReport` calls  -  by [@&#8203;7rulnik](https://github.com/7rulnik) in [#&#8203;11278](vitest-dev/vitest#11278) [<samp>(e8e55)</samp>](vitest-dev/vitest@e8e556ff7)
  - `hanging-process` to use ESM entrypoint  -  by [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in [#&#8203;11316](vitest-dev/vitest#11316) [<samp>(4e91e)</samp>](vitest-dev/vitest@4e91e5668)
- **spy**:
  - Fix stack overflow when spying `Set.prototype.add`  -  by [@&#8203;fengmk2](https://github.com/fengmk2) in [#&#8203;11299](vitest-dev/vitest#11299) [<samp>(a0a93)</samp>](vitest-dev/vitest@a0a939653)
- **ui**:
  - Persist authentication cookie beyond current browser session  -  by [@&#8203;hi-ogawa](https://github.com/hi-ogawa), **Hiroshi Ogawa** and **OpenCode (gpt-5.6-sol)** in [#&#8203;11066](vitest-dev/vitest#11066) [<samp>(f8819)</samp>](vitest-dev/vitest@f88195e16)

#####     [View changes on GitHub](vitest-dev/vitest@v5.0.1...v5.0.2)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMTUuMTMiLCJ1cGRhdGVkSW5WZXIiOiI0NC4xMTUuMTMiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->
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