I generally view dependency install with volo as getting dependencies
for an end project that just consumes them. Many cases the dependency
is just a single JS file.
The case you describe is where you are consuming dependencies to just
do tests and such, but just want to broadcast a different set of
dependencies for people that just want to use your code.
My first thought is that the #2 option makes sense, keeping test
dependencies in the test folder with its own package.json and the top
level package.json for broadcasting the actual dependencies to run the
library during runtime. This may work better too since I believe where
you want to install the test dependencies would be different than
where dependencies would be installed for the runtime library.
However, if it makes sense to include support for devDependencies or
testDependencies then we can look at that. One of the differences with
something like node/npm, the path layout is generally different for
front end projects, and precise paths matter -- the nested
node_modules approach does not work for front end projects.
So my main concern with supporting something like a devDependencies or
testDependencies is what the expectation on where those dependencies
would get installed in the project. That seems to be the issue to sort
out first.
James