setup(options?: ConfigOptions): Task<Config, ConfigFailure>
Builds the merged qunitx config from package.json settings and either an argv or an explicit
ConfigOptions. package.json#qunitx.plugins entries are dynamic-imported into esbuild
plugin objects.
ConfigFailure is declared, so .result() hands back the bare union to branch on with
Failure.is. It reports rather than exits so the daemon — which assembles a config per client
request — can reject one bad flag and stay up; cli.ts turns a failure into an exit.
Lazy, like every Task: nothing is read until it is awaited. With no argument setup reads
process.argv and process.env at that moment, so a caller that lends those globals (the
daemon, via borrowArgv/borrowEnv) must await INSIDE the borrowing scope, not hold the Task
past it. Passing options instead skips the argv read entirely — which is why the JS API needs
no such borrowing.
import * as Config from './config.ts'; import * as Result from '../result/index.ts'; // Defined, not invoked: reads package.json and walks the real fs. async function example() { const config = await Config.setup({ inputs: ['test/'] }).result(); return Result.Failure.is(config) ? config.code : config.inputs; // ConfigFailure, or the Config }
options: ConfigOptions