Skip to content

Function: scanSource() ​

scanSource(options): Inventory

Scans the code of one test file, without reading anything from disk.

Throws a TypeError for invalid options. Problems in the code itself are reported as diagnostics. A custom test object imported from a local file can't be followed here; use scan() for that.

Parameters ​

options ​

code ​

string

relativeFilePath ​

string

Path of the file from the project root, used in the output and in ids.

framework ​

"playwright" | "vitest"

frameworkVersion? ​

string | null

The framework version whose rules apply. The newest rules apply when it is missing.

comments? ​

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

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

Returns ​

Inventory