Finds every test(...) / module(...) declaration in a test file, with the source line range
each one spans — enough to answer "which test is at line 34?".
Every declaration found in a file, plus whether it uses only().
-
declarations: TestDeclaration[]
All test/module declarations, sorted by start line, with
parentlinks resolved. -
hasOnly: boolean
True when the file calls
only(), which makes QUnit ignore every other test in the run.
A test(...) or module(...) call found in a test file, in 1-based source lines.
-
endLine: number
Line of the call's closing paren — so [startLine, endLine] spans the whole body.
-
kind: "test" | "module"
Whether this is a
test(...)or amodule(...)call. -
name: string | null
The literal first argument, or null when it is computed (
test(\case ${i}`)`). -
parent: number | null
Index into
declarationsof the innermost enclosing module, or null at the top level. -
startLine: number
Line of the callee.
Usage
import * as mod from "lib/selection/parse-test-declarations.ts";