Skip to content

Function: scan() ​

scan(options): Promise<Inventory>

Scans the test files that match patterns under root, or without patterns those the configs run, one file at a time.

Throws a TypeError for invalid options. Problems with files and code are reported as diagnostics.

Parameters ​

options ​

patterns? ​

string[]

Glob patterns for the test files, relative to root. As in the runners, they match names that start with a dot too. Without them, the test files are those the configs in the root and the folders below it run, or for node:test and Bun those node --test and bun test run.

framework? ​

"playwright" | "vitest" | "jest" | "mocha" | "jasmine" | "cypress" | "webdriverio" | "node" | "bun"

The runner whose tests are listed. Without it, the one the project uses: whose package a package.json in the root or below lists, whose config is there, or for node:test and Bun, run by a package.json script, else one a package.json above the root lists. With none of them or several, the scan throws a TypeError that names them.

root? ​

string

The project root. Paths in the output are relative to it. Defaults to the current directory.

ignore? ​

string[]

Glob patterns to leave out, in addition to node_modules and .git.

frameworkVersion? ​

string

The framework version whose rules apply, instead of the one read from the project.

comments? ​

"all" | "non-active" | "none"

Which tests get the comments above them. Defaults to non-active.

expandCases? ​

boolean

One test or describe per case of a .each or .for table and per pass of a loop whose values the scan can work out, each with the title the runner gives it. Defaults to false: one record per declaration.

signal? ​

AbortSignal

Stops the scan when it aborts: the scan checks it before it starts and between files, and then rejects with the signal's reason, as fetch does.

Returns ​

Promise<Inventory>

Documentation for test-inventory 0.12.2. Released under the MIT License.