spec icon indicating copy to clipboard operation
spec copied to clipboard

Error running spec on Windows

Open chimon2000 opened this issue 3 years ago • 7 comments

Unhandled exception:
ProcessException: The system cannot find the file specified.

  Command: flutter test --reporter=json --no-pub
#0      _ProcessImpl._start (dart:io-patch/process_patch.dart:401:33)
#1      Process.start (dart:io-patch/process_patch.dart:38:20)
#2      flutterTest.<anonymous closure> (package:dart_test_adapter/src/test_runner.dart:16:19)
#3      _parseTestJsonOutput.<anonymous closure> (package:dart_test_adapter/src/test_runner.dart:64:30)
#4      _parseTestJsonOutput.<anonymous closure> (package:dart_test_adapter/src/test_runner.dart:63:25)
#5      _runGuarded (dart:async/stream_controller.dart:773:24)
#6      _StreamController._subscribe.<anonymous closure> (dart:async/stream_controller.dart:651:7)
#7      _BufferingStreamSubscription._guardCallback (dart:async/stream_impl.dart:417:13)
#8      _StreamController._subscribe (dart:async/stream_controller.dart:650:18)
#9      _ControllerStream._createSubscription (dart:async/stream_controller.dart:786:19)
#10     _StreamImpl.listen (dart:async/stream_impl.dart:473:9)
#11     new TestEventsNotifier.<anonymous closure> (package:spec_cli/src/dart_test.dart:92:25)
<asynchronous suspension>

Steps to reproduce:

  • Install spec using dart pub global activate spec_cli
  • Create a fresh Flutter project
  • Run spec in project

Currently using Flutter 2.10 but I was using the last stable version and getting the same error.

chimon2000 avatar Feb 03 '22 19:02 chimon2000

Are the commands flutter and dart available in your terminal? This error make it seems like one of those commands is missing

rrousselGit avatar Feb 03 '22 20:02 rrousselGit

@rrousselGit I can confirm that both are available:

dart --version && flutter --version
Dart SDK version: 2.16.0 (stable) (Mon Jan 31 15:28:59 2022 +0100) on "windows_x64"
Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (3 days ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2

chimon2000 avatar Feb 04 '22 16:02 chimon2000

I have a feeling from when I did Melos that runInShell and includeParentEnvironment may need to be set to true on Process.start for Windows to work properly and pickup flutter/dart from path

Salakar avatar Feb 08 '22 15:02 Salakar

Wouldn't that slow things quite a bit? Since we'd effectively encapsulate the process in a shell for no reason

rrousselGit avatar Feb 08 '22 15:02 rrousselGit

I can confirm that using runInShell: true fixes the issue for Windows. includeParentEnvironment is true by default.

Besides that, we might also use cmd /c flutter test ..., but it would technically have the same behaviour, and it would be a cumbersome implementation just for the Windows platform.

Another approach is to explicitly use flutter.bat (just for Windows ofc), which would avoid spawning the execution through an OS shell. It worked for me, but I am not entirely sure if it will be enough to overcome this issue.

mrverdant13 avatar Feb 24 '22 02:02 mrverdant13

Still having this problem

kimathi-phil avatar Aug 09 '22 00:08 kimathi-phil