@zuke/node

← API reference

`@zuke/node` — typed Node.js task wrappers for Zuke builds.

Symbols

# NodeEvalSettings class
class NodeEvalSettings extends NodeSettings

Settings for node [options] --eval <code>.

MemberSignatureDoc
code code(source: string): this The JavaScript source to evaluate (required).
requireModule requireModule(...modules: string[]): this Preload a CommonJS module before evaluating (--require <m>); repeatable.
importModule importModule(...modules: string[]): this Preload an ES module before evaluating (--import <m>); repeatable.
print print(): this Print the result of the evaluated code (--print instead of --eval).
# NodeRunSettings class
class NodeRunSettings extends NodeSettings

Settings for node [options] <script> [args].

MemberSignatureDoc
script script(path: PathLike): this The script to execute (required).
scriptArgs scriptArgs(...args: Array<string | number>): this Arguments passed to the script (after the script path).
requireModule requireModule(...modules: string[]): this Preload a CommonJS module before the script (--require <m>); repeatable.
importModule importModule(...modules: string[]): this Preload an ES module before the script (--import <m>); repeatable.
conditions conditions(...names: string[]): this Custom export conditions to resolve (--conditions <c>); repeatable.
envFile envFile(path: PathLike): this Load environment variables from a file (--env-file=<p>).
watch watch(): this Restart the process on file changes (--watch).
watchPath watchPath(...paths: PathLike[]): this Additional paths to watch (--watch-path <p>); repeatable.
enableSourceMaps enableSourceMaps(): this Enable Source Map V3 support for stack traces (--enable-source-maps).
inspect inspect(): this Activate the inspector (--inspect).
inspectBrk inspectBrk(): this Activate the inspector and break before user code starts (--inspect-brk).
maxOldSpaceSize maxOldSpaceSize(megabytes: number): this Set the V8 old-space memory limit in MiB (--max-old-space-size=<n>).
# NodeSettings class
class NodeSettings extends ToolSettings

Shared base for every node task: it pins the binary to node.

# NodeTasks const
const NodeTasks: NodeTasksApi

Typed task functions for the Node.js runtime node.

# NodeTasksApi interface
interface NodeTasksApi

The shape of NodeTasks.

MemberSignatureDoc
run run(configure?: Configure<NodeRunSettings>): Promise<CommandOutput> Run a script: node [options] <script> [args].
eval eval(configure?: Configure<NodeEvalSettings>): Promise<CommandOutput> Evaluate inline code: node --eval <code>.
test test(configure?: Configure<NodeTestSettings>): Promise<CommandOutput> Run the built-in test runner: node --test.
# NodeTestSettings class
class NodeTestSettings extends NodeSettings

Settings for node --test [paths] [flags].

MemberSignatureDoc
paths paths(...values: PathLike[]): this Test files or directories to run (positional); repeatable.
testNamePattern testNamePattern(value: string): this Run only tests whose name matches the pattern (--test-name-pattern <v>).
testReporter testReporter(value: string): this Select the test reporter (--test-reporter <v>).
testConcurrency testConcurrency(value: number): this Maximum number of test files to run concurrently (--test-concurrency <n>).
only only(): this Run only tests marked with the only option (--test-only).
watch watch(): this Re-run tests on file changes (--watch).
experimentalTestCoverage experimentalTestCoverage(): this Collect and report test coverage (--experimental-test-coverage).