function scriptHint
scriptHint(
cwd: string,
file: string,
relativeTo?: (
from: string,
to: string
) => string
): string

The qunitx run <file> line a zero-test run suggests, with forward slashes.

path.relative answers in the host's separator, so on Windows this echoed test\fixtures\seed.ts back at someone who typed test/fixtures/seed.ts. The whole value of the hint is that it pastes straight back into a shell, and forward slashes work in every Windows shell — so the display form wins, exactly as it does for --search's listing.

relativeTo is injected so the Windows shape is provable from a POSIX host.

import path from 'node:path';
import { scriptHint } from './test.ts';

scriptHint('/proj', '/proj/scripts/seed.ts'); // 'qunitx run scripts/seed.ts'
scriptHint('D:\\proj', 'D:\\proj\\scripts\\seed.ts', path.win32.relative);
// 'qunitx run scripts/seed.ts' — never 'scripts\seed.ts'

Parameters

cwd: string
file: string
optional
relativeTo: (
from: string,
to: string
) => string
= relative

Return Type

string

Usage

import { scriptHint } from "lib/commands/test.ts";