pion / ice

A Go implementation of ICE
https://pion.ly/
MIT License
424 stars 158 forks source link

refactor: rename test_utils to utils_test to remove stretchr/testify dep #675

Closed paralin closed 4 months ago

paralin commented 4 months ago

I noticed that the pion-ice package had ~1MB of extra binary size due to the dependency on stretchr/testify.

Renaming test_utils.go to utils_test.go removes stretchr/testify from any non-test build and fixes this dependency. The tests still pass & the package still builds the same.

One can check the dependency graph with goda:

https://github.com/loov/goda

goda graph "reach(.:all, github.com/stretchr/testify/require)" | dot -Tsvg -o graph.svg

image
Sean-Der commented 4 months ago

Nice catch! Do we have this problem anywhere else?

I will add this check to CI

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.15%. Comparing base (fd4b1f8) to head (4272dcf).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #675 +/- ## ========================================== - Coverage 79.25% 79.15% -0.10% ========================================== Files 42 41 -1 Lines 3789 3738 -51 ========================================== - Hits 3003 2959 -44 + Misses 551 547 -4 + Partials 235 232 -3 ``` | [Flag](https://app.codecov.io/gh/pion/ice/pull/675/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [go](https://app.codecov.io/gh/pion/ice/pull/675/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `79.15% <ø> (-0.10%)` | :arrow_down: | | [wasm](https://app.codecov.io/gh/pion/ice/pull/675/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `22.13% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

paralin commented 4 months ago

After applying this PR I don't see any other reference to testify in my project's build which also imports the main webrtc packages. So, I think this is probably the only case where that happened.