Skip to content

Commit eebd58c

Browse files
committed
Enable running console app tests from monorepo root
1 parent 3fd73c0 commit eebd58c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/console_app/test/console_app_test.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22
import 'dart:io';
3+
import 'package:path/path.dart' as path;
34
import 'package:test/test.dart';
45

56
void main() {
@@ -66,10 +67,19 @@ Future<ProcessResult> runConsoleApp(String input) async {
6667
// Use relative path since working directory is console_app
6768
final scriptPath = 'bin/console_app.dart';
6869

70+
final currentDir = Directory.current.path;
71+
72+
// Determine the working directory for the console process:
73+
// - If already in 'console_app' directory, use current directory (null)
74+
// - Otherwise, use relative path to console_app from workspace root
75+
final workingDir = path.basename(currentDir) == 'console_app'
76+
? null
77+
: path.join('packages', 'console_app');
78+
6979
// Start the Dart process
7080
final process = await Process.start('dart', [
7181
scriptPath,
72-
], workingDirectory: Directory.current.path);
82+
], workingDirectory: workingDir);
7383

7484
// Write input to stdin
7585
process.stdin.writeln(input);

0 commit comments

Comments
 (0)