start function
Starts a TestProcess
running executable
, which is the name of the
executable as listed in the pubspec (or in pkg.executables
).
If node
is true
, this will run a NodeJS process using the executable
compiled by pkg-npm-dev
. Otherwise, it will run a Dart VM process using
the executable compiled by pkg-standalone-dev
if one exists and running
from source otherwise.
All other arguments are just like TestProcess.start
and/or
Process.start.
This throws a TestFailure
if it would run a compiled executable that's
out-of-date relative to the pubspec or to source files in lib/
or bin/
.
When using this in multiple tests, consider calling setUpAll
with
ensureExecutableUpToDate to avoid having many redundant test failures for
an out-of-date executable.
Implementation
Future<TestProcess> start(String executable, Iterable<String> arguments,
{bool node = false,
String? workingDirectory,
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
String? description,
required Encoding encoding,
bool forwardStdio = false}) async =>
await TestProcess.start(executableRunner(executable, node: node),
[...executableArgs(executable, node: node), ...arguments],
workingDirectory: workingDirectory,
environment: environment,
includeParentEnvironment: includeParentEnvironment,
runInShell: runInShell,
description: description,
encoding: encoding,
forwardStdio: forwardStdio);