addAppTestsTo function
- TestedApp target,
- List<
MatrixAppTest> tests, { - MatrixEnv? env,
- List<
String> releaseBuildArguments = const [], - CiEnvValues? envValues,
- MatrixFlutter flutter = _flutter,
- FileSystem fileSystem = const LocalFileSystem(),
Adds tests to the generated app of target, an app that smf create
generated outside the matrix, such as one that CI starts on a device: copies
their files with addAppTests, which fills only {{app_name}} in them, and
adds their dev dependencies with flutter pub add through flutter, if
they have any. It runs neither the analysis nor the tests, which the caller
runs where it needs them.
With the app of target, the app of the matrix that it was generated
as, such as an app with every module of the plan of CI that the matrix tool
of the CLI generates with --create --app, it fills the values of the
tests too, and writes the files that they generate for that app (see
MatrixAppTest.generatedFiles), as for an app of the matrix. With the
start check, it also writes the arguments that build that app with its
values, the tool arguments of env for it (startBuildArgumentsFile);
none without the app, whose roles they come from, as the probes of the
tests of the app do.
With the start check, it also writes the releaseBuildArguments, those
that a build of the app as a release takes too
(startReleaseArgumentsFile), with the app or without it.
It writes none of the values that the tests give an app of the matrix
(MatrixAppTest.envValues). With envValues, whose path is a file of
values of CI in the form of the file of env, such as .env, with a
line KEY=value for each key, and with the app, whose build arguments
give the build those values, it writes each of them into the line of
its key in the file of env of the app, where that line has no value
yet, such as the public key of a service of the project of CI. It
leaves out a key that the app has no such line of, and the values of an
app without the file. What it prints names the keys, and no value, but
when the mask of envValues is true, as in a job of GitHub Actions,
it first prints
::add-mask::<value> for each value of the file, as it reads it, a
command that the runner takes and never shows, which hides the value in
the rest of the log of the job, such as where an SDK of the app prints
its key.
Returns 0 and the output, or the exit code of flutter pub add and the
output if it fails. A problem of the files of the tests is a failure
too, with the exit code 1, such as a placeholder that only an app of the
matrix fills, or files that tests generate, without the app; and so is a
problem of envValues, such as a file that is not there, a line that is
no line KEY=value, a key given twice, a value with a double quote, or
values without the app or env.
Implementation
Future<(int, String)> addAppTestsTo(
TestedApp target,
List<MatrixAppTest> tests, {
MatrixEnv? env,
List<String> releaseBuildArguments = const [],
CiEnvValues? envValues,
MatrixFlutter flutter = _flutter,
FileSystem fileSystem = const LocalFileSystem(),
}) =>
_addAndRun(
target,
tests,
_pubAdd(tests),
env: env,
releaseBuildArguments: releaseBuildArguments,
valuesOf: () => envValues == null
? null
: _envValuesOfFile(
envValues.path,
target.app,
env,
target.generated.path,
fileSystem,
mask: envValues.mask,
),
machine: (flutter: flutter, fileSystem: fileSystem),
);