This is a concern with monorepo but you can still enforce the boundaries programmatically. For example you can add some simple, custom lint rules that prevent cross-boundary imports.
Another thing you can do is have your CI only check out specific directories when running tests using something like git’s sparse-checkout.