very_good_cli icon indicating copy to clipboard operation
very_good_cli copied to clipboard

spike: Wrong test suite identified when running "very_good test" with optimization

Open renancaraujo opened this issue 2 years ago • 3 comments

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

  1. run very_good test without --no-optimization
  2. 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.

renancaraujo avatar May 16 '22 11:05 renancaraujo

This needs dedicated research time to identify the core issue before it can be fixed.

BeatriceMitchell avatar Jun 03 '22 15:06 BeatriceMitchell

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 and getIt
  • We were registering our mocks on getIt right on the main() test method, instead of doing so inside a setUp() or setUpAll().
  • 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.

mugbug avatar Jun 10 '22 16:06 mugbug

If you have a simple Bloc test, and the test fails... the assertion is in the package instead of your code

BeatriceMitchell avatar Jun 17 '22 17:06 BeatriceMitchell

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.

renancaraujo avatar Apr 24 '23 18:04 renancaraujo