interface TestDeclaration

A test(...) or module(...) call found in a test file, in 1-based source lines.

const declaration: TestDeclaration = {
  kind: 'test',
  name: 'adds an item',
  startLine: 5,
  endLine: 9,
  parent: 0, // index of the enclosing module declaration; null at the top level
};

Properties

kind: "test" | "module"

Whether this is a test(...) or a module(...) call.

name: string | null

The literal first argument, or null when it is computed (test(\case ${i}`)`).

startLine: number

Line of the callee.

endLine: number

Line of the call's closing paren — so [startLine, endLine] spans the whole body.

parent: number | null

Index into declarations of the innermost enclosing module, or null at the top level.

Usage

import { type TestDeclaration } from "lib/selection/parse-test-declarations.ts";