scarb
scarb copied to clipboard
only build the required files when running a few tests
Problem
when i run a single test via scarb test -f ...
it takes 5-10 seconds just to run
i suspect it's re-building all the code just to run a single test
my repo is quite large and splitting it up is impractical, so i'd like it if scarb only built the required files
Proposed Solution
only build the required files, so it runs faster
Notes
n/a
or ideally add a watch mode that only runs the changed tests and i can just fix my tests in real time
Hmm, this suggestion sounds neat, but I can't see how we can implement this without having incremental compilation in Cairo compiler itself. That's because the compiler is indeed fully rebuilding everything because it is not capable of saving a part of work and reusing it later, it just takes a hash map of package name → source path as sole input.
The only much more coarse thing we can do with Scarb only is that with #380 being done, we could only recompile one of tests/*
files whenever it's changed, instead of recompiling everything. But this won't help a lot I think
it takes 45 seconds just to compile so i can run a single test in the ekubo contracts repo right now. i'm used to it but this feels very high priority for codebases with significant amount of complexity. is there any other solution?
We have identified a regression in Scarb 2.3.0-rc0, which we will fix in 2.3.0-rc1, to be released in couple of days. This should help with your 45s build time situation.
Other than that, we can only push Cairo team to prioritise this work.
Hello dear @mkaput , I just followed this thread and I am facing the same situation as @moodysalem. When performing tests on large codebases its impractical to wait for a considerably long compilation time. Idk in which stage of improving this you are now as I saw your last comment was to push Cairo team for it.
Thanks a lot in advance!,
Hey @fvelazquez-X! This is still a low-priority thing upstream. We've been discussing this recently and there are no updates on this front.
We are not saying this is not important. We agree it is! But the Cairo team identifies more critical features to implement now.
Update: As for now, incremental compilation is not planned to be worked on.