Skip to content

feat(shard): allow a custom shards file via PEST_SHARD_FILE - #1962

Open
mudandstars wants to merge 1 commit into
pestphp:5.xfrom
mudandstars:feat/shard-file-env
Open

mudandstars wants to merge 1 commit into
pestphp:5.xfrom
mudandstars:feat/shard-file-env

Conversation

@mudandstars

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix
  • New Feature

Description:

Time-based sharding always reads/writes tests/.pest/shards.json. Projects that shard several suites in separate CI lanes (e.g. a backend suite and a Pest Browser suite running on different runners) can't share that file: --update-shards prunes timings to the tests of the current run, so each lane's refresh wipes the other lane's timings.

This adds a PEST_SHARD_FILE environment variable (same style as the existing PEST_SHARD_MAX_FILTER_LENGTH) to point both --update-shards and --shard at another file:

PEST_SHARD_FILE=tests/.pest/browser-shards.json ./vendor/bin/pest --testsuite=Browser --update-shards
PEST_SHARD_FILE=tests/.pest/browser-shards.json ./vendor/bin/pest --testsuite=Browser --shard=1/2

Relative paths resolve against the project root; absolute paths (POSIX, Windows drive, UNC) are used as is. Without the variable nothing changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@MrPunyapal

Copy link
Copy Markdown
Member

Can you rebase this onto 5.x and keep Shard::useTimingsFile() working when PEST_SHARD_FILE is unset? 5.x now lets plugins choose a timings filename. Please keep that fallback and make the read and update messages show the custom path when it is set.

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