Skip to the content.

Interface: Options

default.Options

Hierarchy

Table of contents

Properties

Properties

100

Optional 100: boolean

Fails if coverage falls below 100%.

Default Value

false

Inherited from

Options.100


all

Optional all: boolean

If true, all files specified with the options src, include, exclude and extension will be loaded into the report. If any of those files remain uncovered, they will be factored into the report with a default of 0% coverage.

Default Value

false

Inherited from

Options.all


allowExternal

Optional allowExternal: boolean

Inherited from

Options.allowExternal


branches

Optional branches: number

Percentage of branches that must be covered for the check to pass. This setting is ignored if option 100 is used.

Default Value

0

Inherited from

Options.branches


c8Config

Optional c8Config: string

Path to c8 JSON configuration file. If not provided, c8js searches for files named '.c8rc', '.c8rc.json', '.nycrc', or '.nycrc.json', starting from cwd and walking up the filesystem tree. This setting is ignored if option useC8Config is set to false.

Inherited from

Options.c8Config


checkCoverage

Optional checkCoverage: boolean

Whether to check that code coverage is within the specified thresholds. This setting is ignored if option 100 is used.

Default Value

false

Inherited from

Options.checkCoverage


clean

Optional clean: boolean

If false, temporary V8 coverage files will not be deleted before subprocess execution.

Default Value

false

Inherited from

Options.clean


cwd

Optional cwd: string | URL

Current working directory of the subprocess, project root of reports and base directory for all relative paths. Must be an absolute path.

Default Value

process.cwd

Inherited from

Options.cwd


encoding

Optional encoding: null | "buffer" | BufferEncoding

The character encoding used to decode the stdout and stderr output. If 'buffer', or an unrecognized character encoding is specified, Buffer objects will be returned instead of strings.

Default Value

'utf8'

Inherited from

Options.encoding


env

Optional env: ProcessEnv

Environment key-value pairs.

Default Value

process.env

Inherited from

Options.env


exclude

Optional exclude: string | string[]

Glob patterns matching files that should be excluded from coverage.

Default Value

await import('@istanbuljs/schema/default-exclude.js')

Inherited from

Options.exclude


excludeAfterRemap

Optional excludeAfterRemap: boolean

Whether to apply exclusion logic after source maps are used to remap compiled to original source files, or before.

Default Value

false

Inherited from

Options.excludeAfterRemap


excludeNodeModules

Optional excludeNodeModules: boolean

Whether or not to exclude all 'node_module' folders.

Default Value

true

Inherited from

Options.excludeNodeModules


extension

Optional extension: string | string[]

Only files matching these extensions will be included in coverage.

Default Value

['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx']

Inherited from

Options.extension


functions

Optional functions: number

Percentage of functions that must be covered for the check to pass. This setting is ignored if option 100 is used.

Default Value

0

Inherited from

Options.functions


gid

Optional gid: number

Sets the group identity of the process.

Inherited from

Options.gid


include

Optional include: string | string[]

Glob patterns matching files that should be included in coverage. An empty array matches all files.

Default Value

[]

Inherited from

Options.include


killSignal

Optional killSignal: number | Signals

The signal value used to kill the subprocess in case of timeout, buffer overflow, or when the current process exits.

Default Value

'SIGTERM'

Inherited from

Options.killSignal


lines

Optional lines: number

Percentage of lines that must be covered for the check to pass. This setting is ignored if option 100 is used.

Default Value

90

Inherited from

Options.lines


maxBuffer

Optional maxBuffer: number

Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the subprocess is terminated and any output is truncated.

Default Value

1024 * 1024

Inherited from

Options.maxBuffer


mergeAsync

Optional mergeAsync: boolean

Merges all V8 coverage reports asynchronously and incrementally to avoid OOM issues.

Default Value

false

Inherited from

Options.mergeAsync


omitRelative

Optional omitRelative: boolean

Inherited from

Options.omitRelative


perFile

Optional perFile: boolean

Checks thresholds on a per-file basis.

Default Value

false

Inherited from

Options.perFile


reporter

Optional reporter: string | string[]

Coverage reporter(s) to use.

Default Value

'text'

Inherited from

Options.reporter


reporterOptions

Optional reporterOptions: Record<string, Record<string, unknown>>

An object mapping reporter names to additional options passed directly to the respective reporters.

Inherited from

Options.reporterOptions


reportsDirectory

Optional reportsDirectory: string

Directory where coverage reports will be output to. The specified directory is ignored if none of the selected reports writes to disk. This option is used to determine the location of tempDirectory, if not specified.

Default Value

'coverage'

Inherited from

Options.reportsDirectory


resolve

Optional resolve: string

Inherited from

Options.resolve


silent

Optional silent: boolean

If true, stdin, stdout, and stderr of the subprocess will be piped to the current process, otherwise they will be inherited from the current process.

Default Value

false

Inherited from

Options.silent


skipFull

Optional skipFull: boolean

If true, files with 100% statement, branch, and function coverage will not be shown by the text reporter.

Default Value

false

Inherited from

Options.skipFull


src

Optional src: string | string[]

Overrides cwd as the location where source files are looked for when the option all is specified. This allows for workspaces spanning multiple projects.

Inherited from

Options.src


statements

Optional statements: number

Percentage of statements that must be covered for the check to pass. This setting is ignored if option 100 is used.

Default Value

0

Inherited from

Options.statements


tempDirectory

Optional tempDirectory: string

Directory where temporary V8 coverage files are written to and read from. This directory will be created if it does not exist. Defaults to a subdirectory named 'tmp' in the directory specified by reportsDirectory.

Inherited from

Options.tempDirectory


throwExecError

Optional throwExecError: "never" | "early" | "late"

Controls how an error during subprocess execution is reported to the caller.

An unrecognized value behaves like 'early'. In all cases, the Error object thrown or returned will be similar to the first argument passed to a callback of execFile.

Default Value

'early'

Inherited from

Options.throwExecError


timeout

Optional timeout: number

The maximum amount of time the process is allowed to run in milliseconds. A non-positive value means no time limit.

Default Value

undefined

Inherited from

Options.timeout


uid

Optional uid: number

Sets the user identity of the process.

Inherited from

Options.uid


useC8Config

Optional useC8Config: boolean

If false, c8js will not load c8 options from a c8 section in 'package.json', or from a JSON configuration file on disk.

Default Value

true

Inherited from

Options.useC8Config


watermarks

Optional watermarks: Watermarks

Thresholds for low and high code coverage watermarks, exposed by some reporters.

Inherited from

Options.watermarks


wrapperLength

Optional wrapperLength: number

Inherited from

Options.wrapperLength