fix: passing extra args disables test optimization
kelvinwieth opened this issue · comments
Description
Running very_good test
with extra args --
, for instance very_good test -- --no-sound-null-safety
, disables test optimization.
Steps To Reproduce
Within a Flutter project, run very_good test -- --coverage
, or use any other extra arg, like --no-sound-null-safety
or --total-shards 3 --shard-index 0
.
Expected Behavior
No test optimization file will be generated, so the optimization will be disabled.
Screenshots
Since it's impossible to screenshot an unexistent file, here's the console output for both very_good test
and very_good test -- --no-sound-null-safety
:
❯ very_good test
Running "flutter test" in /Users/kelvin.wieth/src/repos/demos/test_perf...
✓ Optimizing tests (0.1s)
00:01 +1: All tests passed!
❯ very_good test -- --no-sound-null-safety
Running "flutter test" in /Users/kelvin.wieth/src/repos/demos/test_perf...
00:05 +1: All tests passed!
Additional Context
Using the 0.0.14
version of very_good_cli
, since I cannot upgrade my Dart version yet.
Some context here:
This happens because the args package doesn't differentiate the "rest" of commands from arguments past the "argument terminator" (--
).
Since the optimization doesn't happen when a test file is specified (very_good test text/my-file.dart
), there is a condition where the optimization is turned off if any unspecified argument is found ("rest").
I was able to reproduce using Very Good CLI v0.16.0.
My reproductive steps:
- Create a Flutter example app:
flutter create counter_app
- Run Very Good CLI with "-- --coverage" (from project root):
very_good test -- --coverage
All test pass but were not optimised.