Closed pleunv closed 2 weeks ago
since it parses all test files and returns a list containing every individual test case
It doesn't parse it, it runs the code to collect tests. This is what mocha does for example.
Can I try working on this ?
Can I try working on this ?
Sure
Clear and concise description of the problem
https://github.com/vitest-dev/vitest/issues/2901 lead to the introduction of the
vitest list
command, but unfortunately this is pretty slow and requires some processing if you're only interested in a list of files that will run with the given filters & flags (i.e.--changed
), since it parses all test files and returns a list containing every individual test case. What I ideally would want is a command that returns which files are going to be executed given the provided filters & flags without drilling down to individual test cases, requiring only a lookup and eliminating the need for a parse, thus being a lot quicker.My main use-case for this is dynamic sharding, where I dynamically determine the amount of shards and agents I want to spin up based on a predetermined number
TESTS_PER_SHARD
(i.e.100
), which serves to keep the test performance stable, irregardless of number of tests. Jest for example can achieve this with--listTests [--json]
, which runs in under a second for ~1k test files and leads to the following output:jest --listTests
jest --listTests --json
For comparison, running
vitest list --json
on an M1 MBP for the same ~1k files takes 3.5 minutes.Suggested solution
Since there is already a dedicated
list
command I suppose it would make sense to provide a new optional flag, i.e.--filesOnly
.Alternative
No response
Additional context
No response
Validations