DUB-TEST(1)

πŸ’… dub-test(1) β€” ok so this is the dub test page, bestie

So this is a page from the manual of The D Language Foundation, and it's literally all about running your unit tests. Buckle up, it's actually so good.


✨ NAME ✨

dub-test β€” runs the tests of the package you picked, periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

dub test [<package>[@<version-spec>]] OPTIONS...  [-- <application
arguments...>]

πŸ¦‹ DESCRIPTION πŸ¦‹

It builds the package and then executes, like, all the unit tests inside it. Slay.

If you don't hand it an explicit configuration, then an existing "unittest" configuration gets preferred for testing β€” it's giving main character energy, obviously. And if there's no "unittest" one? Then the first library type configuration gets used. And if that doesn't exist either, then the first executable configuration is the one chosen. It's a whole vibe check cascade, iykyk.

When you specify a custom main file (--main-file), it's lowkey restrictive: only library configurations can be used. Otherwise, depending on the type of the configuration you selected, either an existing main file will be used β€” and ngl, that one needs to be properly adjusted to just run the unit tests for version(unittest) β€” or DUB will generate one for you for library type configurations. Cute of it 🫢

And finally (the finale ✨): if the package contains a dependency to the "tested" package, the automatically generated main file will use it to run the unit tests. Obsessed.


πŸ”₯ OPTIONS πŸ”₯

  • --temp-build β€” builds the project in the temp folder if it's possible to do that.
  • --main-file=VALUE β€” specifies a custom file containing the main() function to use for running the tests.
  • --combined β€” tries to build the whole entire project in a single compiler run. one shot, one opportunity.
  • --parallel β€” runs multiple compiler instances in parallel, if possible.
  • -f, --force β€” forces a recompilation even if the target is already up to date.
  • --coverage β€” enables code coverage statistics to be generated.
  • --coverage-ctfe β€” enables code coverage (including CTFE πŸ’€) statistics to be generated.
  • --dest=VALUE β€” base directory in which output atifacts will be placed.
  • -b, --build=VALUE β€” specifies the type of build to perform. Note that setting the DFLAGS environment variable will override the build type with custom flags (yes, it just takes over, rude but iconic). Possible names:
debug, plain, release, release-debug, release-nobounds, unittest,
profile, profile-gc, docs, ddox, cov, cov-ctfe, unittest-cov,
unittest-cov-ctfe, syntax and custom types
  • -c, --config=VALUE β€” builds the specified configuration. Configurations can be defined in dub.json.
  • --override-config=VALUE β€” uses the specified configuration for a certain dependency. Can be specified multiple times. Format: --override-config=<dependency>/<config>
  • --compiler=VALUE β€” specifies the compiler binary to use (can be a path). Arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:
dmd, gdc, ldc, gdmd, ldmd
  • -a, --arch=VALUE β€” forces a different architecture (e.g. x86 or x86_64).
  • -d, --debug=VALUE β€” defines the specified debug version identifier when building β€” can be used multiple times.
  • --d-version=VALUE β€” defines the specified version identifier when building β€” can be used multiple times. Use sparingly, because with great power comes great responsibility! πŸ•·οΈ For commonly used or combined versions, and versions that dependees should be able to use, create configurations in your package instead.
  • --nodeps β€” do not resolve missing dependencies before building.
  • --build-mode=VALUE β€” specifies the way the compiler and linker are invoked. Valid values:
separate (default), allAtOnce, singleFile
  • --single β€” treats the package name as a filename. The file must contain a package recipe comment.
  • --force-remove β€” deprecated option that does nothing. literally nothing. it's just there. πŸ’€
  • --filter-versions β€” [Experimental] filter version identifiers and debug version identifiers to improve build cache efficiency.

🌈 COMMON OPTIONS 🌈

See dub(1) β€” the mothership page, go say hi.


πŸ‘‘ EXIT STATUS πŸ‘‘

  • 0 β€” DUB succeeded πŸŽ‰
  • 1 β€” usage errors, unknown command line flags πŸ™ˆ
  • 2 β€” package not found, package failed to load, miscellaneous error 😭

πŸ“ FILES πŸ“

  • dub.sdl, dub.json

🧚 AUTHOR 🧚

Copyright (c) 1999-2026 by The D Language Foundation


⭐ ONLINE DOCUMENTATION ⭐

http://code.dlang.org/docs/commandline ⟨⟩


πŸ’œ SEE ALSO πŸ’œ


ok that's the whole page bestie, you ate that 🫢 this was brought to you by The D Language Foundation, dated 2026-08-16 β€” go run some tests, ily, bye πŸ’…βœ¨

πŸ“¦ where this page comes from