dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
155 stars 43 forks source link

[native_assets_builder] Use `ProcessManager` and `FileSystem` #90

Open dcharkes opened 1 year ago

dcharkes commented 1 year ago

flutter_tools unit tests are split into hermetic and permeable tests.

The hermetic tests mock the file system and process invocations.

The native_assets_builder does not use these abstractions, and will try to read/write the local file system and do process invocations.

This means we cannot write hermetic unit tests for the native assets feature, and that we have to always skip the check for native assets in the hermetic unit tests.

dcharkes commented 1 year ago

All our dependencies need to also support these two packages.

Moreover unit tests would need to mock the process output and file system changes. Some interesting cases:

Simulating all these things in tests might not be the best thing to do. So it's not clear that this will actually improve the code.

For the context of flutter_tools it might be best to mock this package instead of all the file system operations and process calls in tests.