method ReplSession.eval
ReplSession.eval(
input: string,
options?: { whole?: boolean; }
): Promise<ReplResult>

Evaluates one input in the page and resolves with what to print.

Tests the input registered are run before this resolves and reported as they finish, so the TAP for a test typed at the prompt lands ahead of the value — where a reader expects it.

whole says there is no more input coming. A LINE being typed can be unfinished — const a = { means keep going, and ReplResult.incomplete is how the prompt is told to. A saved buffer cannot: you closed the editor, so an unfinished parse is a syntax error and saying nothing about it is the worst of the three things this could do.

Parameters

input: string
optional
options: { whole?: boolean; }

Return Type

Promise<ReplResult>

Usage

import { type ReplSession } from "lib/repl/session.ts";