Skip to navigation

config

Configuration options for Doc Detective operations.

Fields

Validation applies the defaults shown here.

FieldTypeDescriptionDefault
$schemastringOptional. JSON Schema URL for editor support. Doc Detective ignores it.

Minimum length: 1
—
configIdstringOptional. Identifier for the configuration.—
configPathstringReadOnly. Path to the configuration file.—
inputone of:
- string
- array of string
Optional. Path(s) to test specifications and documentation source files. May be paths to specific files or to directories to scan for files..
outputstringOptional. Path of the JSON results file. It’s overwritten on each run. A folder isn’t valid here: use outputDir.—
outputDirstringOptional. Path of the folder that holds the run folder and the html, junit, and markdown reports..
reportersarray of stringOptional. Reporters to use when emitting test results: terminal, json, html, runFolder, junit (JUnit XML for CI test-summary widgets, written as junit.xml in the output directory, or beside output when it names a file), and markdown (a run summary for CI job summaries and merge request comments, written as doc-detective-summary.md in the output directory, or beside output when it names a file). The runFolder reporter (on by default) archives each run’s results as <outputDir>/.doc-detective/runs/<runId>/testResults.json, beside any screenshots the run captured, in addition to the flat output the json reporter writes. Reporters are a CLI feature: the JavaScript API’s runTests() returns results and ignores this setting.["terminal","runFolder"]
specFilterarray of stringOptional. Regex patterns (case-insensitive) applied to each spec’s specId. If set, only specs whose specId matches at least one pattern are run. Equivalent to --spec on the CLI. Each entry must contain at least one non-whitespace character.—
testFilterarray of stringOptional. Regex patterns (case-insensitive) applied to each test’s testId. If set, only tests whose testId matches at least one pattern are run. Equivalent to --test on the CLI. Each entry must contain at least one non-whitespace character.—
recursivebooleanOptional. If true, searches the input, beforeAll, and afterAll folders recursively for test specifications and source files.true
relativePathBasestringOptional. Whether paths should be interpreted as relative to the current working directory (cwd) or to the file in which they’re specified (file).

Accepted values: cwd, file
file
loadVariablesstringOptional. Load environment variables from the specified .env file.—
publicVariablesarray of stringOptional. Environment variables whose values Doc Detective shows in output. By default, Doc Detective masks the value of every variable a run substitutes or loads, and of any variable whose name contains TOKEN, SECRET, PASSWORD, API_KEY, PRIVATE_KEY, or CREDENTIAL, as ***NAME***. A name listed on the config, any spec, or any test is public for the whole run. * matches any characters, so ["*"] turns masking off.—
originstringOptional. Default protocol and domain to use for relative URLs.—
originParamsobjectOptional. Query parameters to append to URLs resolved against origin. Values support environment variable substitution via $VAR syntax. Step-level params on goTo / checkLink are merged on top of these, with step keys winning on collision. WARNING: values are embedded in request URLs and appear verbatim in test results, logs, and reports — avoid putting long-lived secrets here.{}
beforeAllone of:
- string
- array of string
Optional. Path(s) to test specifications to perform before those specified by input. Useful for setting up testing environments.—
beforeAnyone of:
- string
- array of string
Deprecated: use beforeAll.—
afterAllone of:
- string
- array of string
Optional. Path(s) to test specifications to perform after those specified by input. Useful for cleaning up testing environments.—
detectStepsbooleanOptional. Whether or not to detect steps in input files based on defined markup.true
allowUnsafeStepsbooleanOptional. Whether or not to run potentially unsafe steps, such as those that might modify files or system state.—
processDitaMapsbooleanOptional. If true, processes DITA maps and includes generated files as inputs.true
logLevelstringOptional. Amount of detail to output when performing an operation.

Accepted values: silent, error, warning, info, debug
info
runOnarray of object(context)Optional. Contexts to run the test in. Overrides contexts defined at the config and spec levels.—
fileTypesarray of one of: string, object(File type (custom)), object(File type (executable))Optional. Configuration for file types and their markup detection.["markdown","asciidoc","html","dita"]
integrationsobject(Integrations options)Optional. Options for connecting to external services.—
telemetryobject(Telemetry options)Optional. Options around sending telemetry for Doc Detective usage.{"send":true}
hintsobject(Hints options)Optional. Options for the post-run hints feature. After a test run, Doc Detective may print one short, contextual hint with code samples and links to encourage further engagement (for example, suggesting a CI workflow when none is detected). Doc Detective displays hints only in an interactive terminal (TTY) and only at the default info log level.{"enabled":true}
verificationobject(Verification options)Optional. Options for writing verification results back into source files after a run: verified-by entries, last-verified dates, and “Last verified” badges.{"write":"existing"}
concurrentRunnersone of:
- integer
- boolean
- "auto"
Optional. Number of concurrent test runners. true or "auto" uses one runner per CPU core, up to 4. Equivalent to --concurrent-runners on the CLI.1
environmentobject(Environment details)ReadOnly. Environment information for the system running Doc Detective.—
debugone of:
- boolean
- string
Deprecated and ignored. Previously reserved for an interactive step-through debugger that was never implemented. Retained so existing configs continue to validate. For diagnostics, run doc-detective debug or set the DOC_DETECTIVE_DEBUG environment variable.—
dryRunbooleanOptional. If true, fully resolve tests (file/env config merge, schema validation, file detection, inline-test extraction) and emit the resolved test plan as JSON, but do not execute any steps. Equivalent to --dry-run on the CLI.false
autoScreenshotbooleanOptional. Defaults to true. Captures a screenshot after every step that drives a browser, native app, or device, headless included, unless the step defines its own screenshot. Doc Detective saves images in the per-run artifact directory (<outputDir>/.doc-detective/runs/<runId>/) under the nested resource tree, with each image named by the step’s order, action, and ID (for example, specs/<specId>/tests/<testId>/contexts/<contextId>/screenshots/01-goTo-s4f2a91c.png), so the same step lands on the same relative path in every run’s folder for run-over-run comparison. While this is on, the runFolder reporter runs even if reporters leaves it out. Set false to turn it off. Specs and tests can override this value with their own autoScreenshot fields (test level wins over spec level, which wins over config level). Equivalent to --auto-screenshot and --no-auto-screenshot on the CLI.—
annotationDefaultsobject(Annotation defaults)Optional. Default visual theme for screenshot and recording annotations. Specs and tests can override this value with their own annotationDefaults fields (test level wins over spec level, which wins over config level), and an individual annotation’s style wins over all of them. Fields left unset fall back to Doc Detective’s built-in theme. Setting a theme here keeps every annotated image in a doc set visually consistent.—
autoRecordbooleanOptional. Defaults to true. Records a video of every context that drives a browser, native app, or device: headless Chrome with the browser engine, which captures its tab; headed browsers and desktop apps with the ffmpeg engine; and Android and iOS devices on the device. Headless Firefox runs headed so it can be recorded, when the host can capture the screen. The recording wraps the whole context, alongside any explicit record steps; in headless Chrome, an explicit record step replaces it. Left unset, a context the host can’t record isn’t recorded, and a recording that can’t start is SKIPPED. true is strict: a recording the host can’t make is SKIPPED, and one that fails to start fails. Videos are saved in the per-run artifact directory (<outputDir>/.doc-detective/runs/<runId>/) under the nested resource tree (for example, specs/<specId>/tests/<testId>/contexts/<contextId>/recordings/<contextId>.mp4), so the same context lands on the same relative path in every run’s folder for run-over-run comparison. While this is on, the runFolder reporter runs even if reporters leaves it out. Set false to turn it off. Specs and tests can override this value with their own autoRecord fields (test level wins over spec level, which wins over config level). Equivalent to --auto-record and --no-auto-record on the CLI.—
autoUpdatebooleanOptional. If true (default), the CLI checks for a newer published doc-detective on startup and self-updates before running tests. Updates happen for global (npm i -g) and npx installs only — local installs (where doc-detective is a project dep) get an informational message instead, since auto-updating would mutate the user’s lockfile. CI environments and the DOC_DETECTIVE_SKIP_AUTO_UPDATE=1 env var also skip the check. Set to false to pin to the installed version. Equivalent to --no-auto-update on the CLI.true
exitOnFailbooleanOptional. If true, the CLI exits 1 when any spec’s result is FAIL, and 2 when nothing valid was tested. If false, those outcomes exit 0. It also decides what an invalid spec does, in the CLI and in runTests(). If true, nothing runs. If false, the invalid spec is skipped with a warning, and the rest run. Usage errors, invalid config, and crashes always exit 2. WARNING and SKIPPED results never fail a run.true
shellstringOptional. Default shell for runShell steps (and runCode’s shell-based execution). runShell steps can override this value with their own shell field. cmd and powershell are only supported on Windows. On Windows, bash resolves to Git Bash, which Doc Detective installs automatically if it isn’t present.

Accepted values: bash, cmd, powershell
bash
cacheDirstringOptional. Directory for lazy-installed runtime assets (heavy npm packages, browser binaries, ffmpeg). Defaults to $XDG_CACHE_HOME/doc-detective (%LOCALAPPDATA%\doc-detective on Windows), or ~/.cache/doc-detective. An existing ~/.doc-detective keeps being used. A relative path resolves against the config file. DOC_DETECTIVE_CACHE_DIR and --cache-dir override it, in that order.

Minimum length: 1. Pattern: \S
—
browserFallbackstringOptional. Controls whether a context whose browser cannot start a driver session falls back to another available browser instead of being skipped. Drivers are validated by execution (not just presence) so a present-but-broken driver — for example a partially downloaded geckodriver — no longer silently skips Firefox coverage. auto (default): fall back to any other available browser for both auto-selected and explicitly requested browsers; a fallback away from an explicitly requested browser reports the context as WARNING rather than PASS. explicit: fall back only when the browser was auto-selected; an explicitly requested browser whose driver is broken is skipped with a diagnostic reason. off: never fall back across browsers (driver validation and diagnostic skip reasons still apply). Equivalent to --browser-fallback on the CLI.

Accepted values: auto, explicit, off
auto
retriesintegerOptional. How many times to re-run a whole test context on a fresh session when the session it was running against turns out to be unusable — an early step (like goTo) passes, then a later step fails because the session or page is gone. After any failing context, an active probe checks the session and retries only when it finds one of three unambiguous signs: the session is dead (WebDriver ECONNREFUSED / invalid session id), it is alive but sitting on a browser crash or error page (chrome-error:, about:neterror), or it is alive but never left its initial blank document, meaning the context never actually got started. A page a test could legitimately be on is never treated as a retry signal, so a real assertion failure (the session is alive, the page loaded, the element genuinely isn’t there) always fails and is never retried. Defaults to 1; set to 0 to disable and keep the exact single-attempt behavior. Contexts can override this with their own retries field. This is distinct from a step’s retry route, which re-runs a single step on the same session — retries re-runs the whole context on a new session. That route’s retry.limit sets its count, and the step’s attempts result field reports how many times it ran. Capped at 10 to prevent a runaway retry storm from a misconfiguration.

Minimum: 0. Maximum: 10
1

Examples

{}
{
"shell": "powershell"
}
{
"verification": {
"write": true
}
}
{
"input": ".",
"outputDir": ".",
"recursive": true,
"loadVariables": ".env",
"fileTypes": [
"markdown"
],
"reporters": [
"terminal",
"json",
"html"
]
}
{
"origin": "https://my-app.com",
"originParams": {
"__clerk_testing_token": "$CLERK_TESTING_TOKEN"
}
}
{
"fileTypes": [
{
"extends": "markdown",
"extensions": [
"md",
"markdown",
"mdx"
],
"inlineStatements": {
"testStart": "<!--\\s*testStart\\s*(.*?)\\s*-->",
"testEnd": "<!-- testEnd -->",
"ignoreStart": "<!-- ignoreStart -->",
"ignoreEnd": "<!-- ignoreEnd -->",
"step": "<!--\\s*step\\s*(.*?)\\s*-->"
},
"markup": [
{
"name": "onscreenText",
"regex": "\\*\\*.+?\\*\\*",
"actions": "find"
}
]
}
]
}
{
"fileTypes": [
{
"name": "Jupyter Notebooks",
"extensions": "ipynb",
"runShell": {
"command": "jupyter",
"args": [
"nbconvert",
"--to",
"script",
"--execute",
"$1",
"--stdout"
]
}
},
{
"name": "JavaScript",
"extensions": "js",
"runShell": {
"command": "node $1"
}
},
{
"name": "Python",
"extensions": "py",
"runShell": {
"command": "python $1"
}
}
]
}
{
"environment": {
"platform": "windows",
"arch": "x64"
}
}
{
"concurrentRunners": 1
}
{
"concurrentRunners": true
}
{
"concurrentRunners": 4
}
{
"debug": false
}
{
"integrations": {
"docDetectiveApi": {
"apiKey": "your-api-key-here"
}
}
}
{
"processDitaMaps": true
}
{
"integrations": {
"heretto": [
{
"name": "example",
"organizationId": "your-organization-id",
"username": "your-username",
"apiToken": "your-api-token"
}
]
}
}
{
"testFilter": [
"smoke",
"login"
],
"specFilter": [
"auth"
]
}
{
"autoScreenshot": true,
"outputDir": "./test-results"
}
{
"input": ".",
"annotationDefaults": {
"color": "#E11D48",
"strokeWidth": 3,
"badge": {
"background": "#E11D48",
"color": "#FFFFFF"
}
}
}