June 27, 2018
I like to use fluent-asserts (https://github.com/gedaiu/fluent-asserts), but I seem to be missing something in how to only add that as a dependency for the unittest builds.

The documentation encourages overwriting the unittest configuration, but when I do this it changes a large number of things including removing the normal release and debug builds and trying to build as a shared library instead of an application.

I believe I have a dub.json configuration question that boils down to:
* How do I add a dependency when running "dub test" without changing all of the default configurations?
* Do I have to completely define all of the configurations that dub provides by default once I decide to make a custom configuration?
* If so, how can I see what the boilerplate would be for all of those configurations to have a sane starting point?

What fluent asserts recommends with I believe a lot of necessary stuff omitted in the "..."'s:
    ...
    "configurations": [
        ...
        {
            "name": "unittest",
            "dependencies": {
                "fluent-asserts": "~>0.9.0",
                ...
            }
        },
        ...
    ]
    ...

Using the dlanguage/ldc:1.9.0 Docker image.
June 27, 2018
On Wednesday, 27 June 2018 at 16:53:49 UTC, Ben Goodwyn wrote:
> I like to use fluent-asserts (https://github.com/gedaiu/fluent-asserts), but I seem to be missing something in how to only add that as a dependency for the unittest builds.
>
> The documentation encourages overwriting the unittest configuration, but when I do this it changes a large number of things including removing the normal release and debug builds and trying to build as a shared library instead of an application.
>
> I believe I have a dub.json configuration question that boils down to:
> * How do I add a dependency when running "dub test" without changing all of the default configurations?
> * Do I have to completely define all of the configurations that dub provides by default once I decide to make a custom configuration?
> * If so, how can I see what the boilerplate would be for all of those configurations to have a sane starting point?
>
> What fluent asserts recommends with I believe a lot of necessary stuff omitted in the "..."'s:
>     ...
>     "configurations": [
>         ...
>         {
>             "name": "unittest",
>             "dependencies": {
>                 "fluent-asserts": "~>0.9.0",
>                 ...
>             }
>         },
>         ...
>     ]
>     ...
>
> Using the dlanguage/ldc:1.9.0 Docker image.

I found a pattern that works. It seems what was missing was having the first configuration so that the default build works as an exe and then excluding the file with the main() function in the unittest configuration.

  "configurations": [
    {
      "name": "executable"
    },
    {
      "name": "unittest",
      "excludedSourceFiles": [
        "source/app.d"
      ],
      "sourcePaths": [
        "source",
        "test"
      ],
      "importPaths": [
        "source",
        "test"
      ],
      "dependencies": {
        "fluent-asserts": "~>0.12.0"
      }
    }
  ]