I'm building a custom module (for use on multiple projects) with code that relies on stuff from Drupal core and third party modules (e.g. extending classes, implementing interfaces, annotating as plugins, etc.). I would like to start writing tests for them, with unit tests to begin with. But so far, all of the resources point to putting the module in a Drupal installation and test in that setup, as if I'm running a full Drupal site - even for a unit test.
I was more imagining that my module would have the runner, the dependencies, and Drupal core be dependencies (or dev dependencies) - just like how JavaScript tests are usually written, whether it's unit tests or headless browser tests. That is, JavaScript testing doesn't require you to pop your code in some other code before you can start testing.
Can this be achieved? Or is putting the my modules code in a Drupal install really the only way to test Drupal modules?