function resolve
resolve(
filePath: string,
lines: number[],
displayPath?: string
): Promise<LineTargetResolution>

Resolves file#34 line targets into exact QUnit selections.

A line resolves to the innermost declaration spanning it. Landing in a test(...) selects that test; landing in a module(...) but outside every test selects the whole module. Anything that cannot be resolved degrades — to the enclosing module, or to the whole file — and says so, rather than failing the run.

import * as LineTargets from './line-targets.ts';

const { selectors, warnings } = await LineTargets.resolve('/tmp/qunitx-doc-missing-test.ts', [34]);
selectors; // null — an unreadable file degrades to running the whole file
warnings; // ['could not read /tmp/qunitx-doc-missing-test.ts — running the whole file']

Parameters

filePath: string
lines: number[]
optional
displayPath: string = filePath

Return Type

Usage

import { resolve } from "lib/selection/line-targets.ts";