very_good_cli
very_good_cli copied to clipboard
spike: Wrong test suite identified when running "very_good test" with optimization
Description
As described here, when running very_good test
with optmization, the internal tooling will identify <cwd>/test/.test_runner.dart
as the suite of tests.
Steps To Reproduce
- run
very_good test
without--no-optimization
- Any output of failing tests will accuse
<cwd>/test/.test_runner.dart
as output.
Expected Behavior Outputs should show the real test suite,
Additional Context
As <cwd>/test/.test_runner.dart
is a temporary file generated by mason, it is expecetd to somehow proxy the real suite or somehow allow its recover from some other field (group name without snake case?).
It is important that we are bound to the information passable via the JSON Reporter Protocol.
This needs dedicated research time to identify the core issue before it can be fixed.
Not sure if this helps with the solution but:
I was experiencing the same problem when trying to use very_good test
with optimization. I was able to fix this by fixing some of our tests.
Basically the fix was:
- We use
injectable
andgetIt
- We were registering our mocks on
getIt
right on themain()
test method, instead of doing so inside asetUp()
orsetUpAll()
. - Moving those to a
setUpAll()
seemed to fix this weird failing test message
After that, I just needed to do some getIt.reset(dispose: false)
in some places to avoid dependency between tests.
If you have a simple Bloc test, and the test fails... the assertion is in the package instead of your code
Well, since this was open, there were a lot of changes that improved the output of the test optimizer. Like https://github.com/VeryGoodOpenSource/very_good_cli/pull/397 and https://github.com/VeryGoodOpenSource/very_good_cli/pull/563
These changes show the correct location of the failing tests. So we can consider this one as fixed as possible.