selectorsFromScan(): LineTargetResolution
Resolves line targets against an ALREADY-parsed scan. Split out so --search, which has scanned
every file for its listing, can resolve line targets without reading and esbuild-transforming
those files a second time.
import * as LineTargets from './line-targets.ts'; import type { DeclarationScan } from './parse-test-declarations.ts'; const scan: DeclarationScan = { hasOnly: false, declarations: [ { kind: 'module', name: 'Cart', startLine: 1, endLine: 20, parent: null }, { kind: 'test', name: 'adds an item', startLine: 5, endLine: 9, parent: 0 }, ], }; LineTargets.selectorsFromScan(scan, [6], 'cart-test.ts').selectors; // [{ module: 'Cart', test: 'adds an item' }] LineTargets.selectorsFromScan(scan, [15], 'cart-test.ts').selectors; // [{ module: 'Cart' }] — outside every test