Repository navigation
Conversation
Adds a --shard=current/total CLI flag (and filters.shard config option) to run a deterministic subset of test files. Files are distributed in round-robin order after the files filter, with the index continuing across suites.
sakib412
marked this pull request as ready for review
October 8, 2026 09:35
Contributor
|
Looks great. Can you please also open another PR for the Japa and AdonisJS docs? Also, it will be nice if we can share some common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the discussion with @thetutlage on the AdonisJS Discord about speeding up large suites in CI.
What
Adds a
--shard=current/totalflag that runs a deterministic subset of test files, so a large suite can be split across parallel CI jobs:The same option can be set in config through
filters.shard, for example to wire it to environment variables:How it works
Planner, after the--filesfilter and the suites filter. Test-level filters (--tests,--tags,--groups) still apply afterwards, inside the refiner.functionalsuite is spread out instead of landing on one shard).FilesManager. Whenfilesis a function, the order it returns is used as-is.0/4,5/4,1/0,abc,1.5/4) throw a validation error from the planner, and the process exits with code1.Why not in the assembler?
In CI each shard usually runs as its own job, so every shard is already its own process, and doing it in the runner keeps it usable outside AdonisJS. Spawning all shards locally in parallel could be built on top of this flag in
@adonisjs/assemblerlater.Changes
src/cli_parser.ts: register theshardstring flag, plus help text, an example and a notesrc/types.ts: newShardtype;Filters.shardandCLIArgs.shardsrc/config_manager.ts: parse--shardintofilters.shardsrc/validator.ts:validateShardFiltersrc/planner.ts:#applyShard, run after collecting suite filesTesting
npm test(lint + full suite with c8): 73/73 passingnpm run typecheck: clean--shard=1/3,2/3and3/3ran 3, 2 and 2 tests, with no overlap and none missing