how to use dub to run all / chosen dependency lib's unittests
Steven Schveighoffer
schveiguy at gmail.com
Mon Sep 19 23:57:31 UTC 2022
On 9/19/22 7:48 PM, mw wrote:
> Hi,
>
> I'm using dub.json to specify the dependencies libs for my project.
>
> I'm just wondering how I can use dub to run all the tests of those
> dependencies libs (of the transitive closure of *all* the libs) to make
> sure my project is built on a very solid foundation?
>
> I know this could be very time-consuming, probably will run it over-night.
>
> On the other hand, what's the command to run dub test on a single
> dependency lib?
>
>
> Thanks.
>
I don't see any specific command to do it in dub itself.
I've recently discovered that `dub describe` gives you the directories
of all your dependencies in a JSON format.
I used this to write an install script for dependent library artifacts.
See
[here](https://github.com/schveiguy/raylib-d/blob/master/install/source/app.d).
It would be pretty easy to do the same thing to run dependency unit
tests. e.g. something like `foreach(dir; getDubDependencyDirectories) {
cd(dir); execute("dub", "test"); }`
You'd have to write getDubDependencyDirectories. But it's just parsing JSON.
-Steve
More information about the Digitalmars-d-learn
mailing list