addAppTestsTo function

Future<(int, String)> addAppTestsTo(
  1. GeneratedApp generated,
  2. List<MatrixAppTest> tests, {
  3. MatrixApp? app,
  4. MatrixFlutter flutter = _flutter,
  5. FileSystem fileSystem = const LocalFileSystem(),
})

Adds tests to generated, 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 app, the app of the matrix that generated 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 app (see MatrixAppTest.generatedFiles), as for an app of the matrix.

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 app.

Implementation

Future<(int, String)> addAppTestsTo(
  GeneratedApp generated,
  List<MatrixAppTest> tests, {
  MatrixApp? app,
  MatrixFlutter flutter = _flutter,
  FileSystem fileSystem = const LocalFileSystem(),
}) =>
    _addAndRun(
      generated,
      app,
      tests,
      _pubAdd(tests),
      flutter: flutter,
      fileSystem: fileSystem,
    );