interface UpgradeDeps

The seams run reaches the world through: the channel it believes it is, the release lookup, the installer, and where its text goes. Every one defaults to the real thing.

import type { UpgradeDeps } from './index.ts';

const deps: UpgradeDeps = { channel: { kind: 'source', entry: '/repo/cli.ts' } };
deps.channel?.kind; // 'source' — refuses without a single network call

Properties

optional
console: Console

Where the command's output goes. Defaults to the process streams.

optional
channel: Channel.InstallChannel

The install channel. Defaults to Channel.detect.

optional
currentVersion: string

The version considered installed. Defaults to this package's.

optional
find: (version?: string) => Promise<Release.Release>

The release lookup. Defaults to Release.find.

optional
apply: (plan: Install.InstallPlan) => Promise<string[]>

The installer. Defaults to Install.apply.

optional
platform: NodeJS.Platform

Platform used for asset selection. Defaults to the host's.

optional
arch: string

Architecture used for asset selection. Defaults to the host's.

optional
spawn: (argv: string[]) => Promise<Process.SpawnResult>

Runs another tool's installer. Defaults to Process.spawn.

optional
allowSelfUpgrade: boolean

Whether qunitx may run another tool's installer on the user's behalf. Defaults to true unless QUNITX_NO_SELF_UPGRADE is set — for a locked-down image, a CI box, or anywhere the answer to "may this process install things" is no. Blocked, upgrade prints the command it would have run and exits 1, which is what it did before it could run anything.

Usage

import { type UpgradeDeps } from "lib/commands/upgrade/index.ts";