One of the integration tests in the public flutter/samples repo uses Process.start('dart', ["run", "bin/compass_server.dart"], ...)
to start a server during setup.
The call looks sensible but I cannot get it to run inside the test. What’s weird is that the issue seems connected to the integration_test environment, not to the actual call.
Below is a simplified example. This exact file passes all tests when run as a regular test with flutter test test/demo_test.dart
. As an integration test with `flutter test integration_test/demo_test.dart, only the first of the tests passes.
The error message is always ‘ProcessException: No such file or directory’
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
void main() {
test("process call success", () async {
final result = await Process.run("echo", ["some output"]);
print(result.stdout);
});
test("process call failure", () async {
final result = await Process.run("dart", ["--version"]);
print(result.stdout);
});
test("process call fully qualified failure", () async {
final result = await Process.run("/Users/sylvia/flutter/bin/dart", ["--version"]);
print(result.stdout);
});
}
Any explanation? Why is this happening and how can I fix such a test?