How to add a private unregistered package as a dependency to unit testing?

I’m developing the PkgA and writing some unit tests for it. In the unit tests I want to use the package PkgB to test the code. PkgA does not depend on PkgB, only the unit tests depend on it. PkgB is a private unregistered package that I have been working on recently.

I have tried adding the PkgB to the test environment by using

(test) pkg> add 

which adds the package, but when trying to run the tests I get the error

ERROR: can not merge projects

The PkgB works fine by itself, I just can’t get it to work with the unit tests.

So the question is, what is the proper way to add a package as a dependency to the unit tests, when the package is not registered (private, or my own)?

You can achieve this by using LocalRegistry.jl. It’s not too bad to setup.