dub-test - Man Page
Executes the tests of the selected package
Synopsis
dub test [<package>[@<version-spec>]] Options... [-- <application arguments...>]
Description
Builds the package and executes all contained unit tests.
If no explicit configuration is given, an existing "unittest" configuration will be preferred for testing. If none exists, the first library type configuration will be used, and if that doesn't exist either, the first executable configuration is chosen.
When a custom main file (--main-file) is specified, only library configurations can be used. Otherwise, depending on the type of the selected configuration, either an existing main file will be used (and needs to be properly adjusted to just run the unit tests for 'version(unittest)'), or DUB will generate one for library type configurations.
Finally, if the package contains a dependency to the "tested" package, the automatically generated main file will use it to run the unit tests.
Options
- --temp-build
Builds the project in the temp folder if possible.
- --main-file=VALUE
Specifies a custom file containing the main() function to use for running the tests.
- --combined
Tries to build the whole project in a single compiler run.
- --parallel
Runs multiple compiler instances in parallel, if possible.
- -f, --force
Forces a recompilation even if the target is up to date
- --coverage
Enables code coverage statistics to be generated.
- --coverage-ctfe
Enables code coverage (including CTFE) statistics to be generated.
- -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. 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
Force a different architecture (e.g. x86 or x86_64)
- -d, --debug=VALUE
Define the specified `debug` version identifier when building - can be used multiple times
- --d-version=VALUE
Define the specified `version` identifier when building - can be used multiple times. Use sparingly, 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.
- --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.
- --filter-versions
[Experimental] Filter version identifiers and debug version identifiers to improve build cache efficiency.
Common Options
See dub(1)
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-2024 by The D Language Foundation
Online Documentation
See Also
dub(1), dub-build(1), dub-dustmite(1), dub-lint(1), dub-run(1)
Referenced By
dub(1), dub-build(1), dub-dustmite(1), dub-lint(1), dub-run(1).