Skip to content
pubscout

test_process

2.1.1, released 2 years ago by tools.dart.dev

Utility for testing subprocesses with line‑by‑line stdout/stderr streams.

Quiet but busy
$ flutter pub add test_process
Source repository

What it does

Provides a TestProcess class that wraps dart:io Process for easier testing. It offers line‑oriented stdout/stderr streams via StreamQueue and helpers like shouldExit and debugging output.

AI-written summary of version 2.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to run and verify CLI tools or other subprocesses in unit tests.
  • You want line‑by‑line assertions on stdout/stderr using the test package's stream matchers.

Skip it when

  • You are writing production code that launches processes.
  • You need full control over signals on Windows (unsupported).

Strengths

  • Line‑by‑line stdout/stderr streams simplify assertions.
  • Built‑in integration with the test package’s stream matchers.
  • Debugging output automatically shows process logs on failure.

Weaknesses

  • Only intended for testing, not for runtime process management.
  • Limited signal support on Windows.
  • Requires Dart 3.1, so older SDKs cannot use it.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4
import 'package:test/test.dart';
import 'package:test_process/test_process.dart';

void main() {
  test('pub get gets dependencies', () async {
    var process = await TestProcess.start('dart', ['pub', 'get']);
    await expectLater(process.stdout, emits('Resolving dependencies...'));
    await expectLater(process.stdout, emitsThrough('Got dependencies!'));
    await process.shouldExit(0);
  });
}

Alternatives

Packages that do the same job and could replace test_process.

  • process

    Standard dart:io Process API gives full control without testing‑specific helpers.

Works with

Packages commonly used together with test_process: ones it builds on, ones built on it, and its own family.