dartTest function

Stream<TestEvent> dartTest({
  1. List<String>? arguments,
  2. String? workingDirectory,
  3. Map<String, String>? environment,
  4. bool runInShell = false,
  5. StartProcess startProcess = Process.start,
})

Runs dart test and returns a stream of TestEvent reported by the process.

void main() {
  // React to `TestEvent` instances.
  dartTest().listen(print);
}

Implementation

Stream<TestEvent> dartTest({
  List<String>? arguments,
  String? workingDirectory,
  Map<String, String>? environment,
  bool runInShell = false,
  StartProcess startProcess = Process.start,
}) {
  return _runTestProcess(
    () => startProcess(
      'dart',
      ['test', ...?arguments, '--reporter=json'],
      environment: environment,
      workingDirectory: workingDirectory,
      runInShell: runInShell,
    ),
  );
}