Dart-code: Running all tests with debugger using launch.json fails

Created on 30 Oct 2019  路  7Comments  路  Source: Dart-Code/Dart-Code

When run-in "Run All Tests" on VSCODE to a flutter project, it is failing with the error

Shell subprocess terminated by ^C (SIGINT, -2) before connecting to test harness.

dart:async/stream_controller.dart 595:43                     _StreamController.addError
dart:async/stream_controller.dart 862:13                     _StreamSinkWrapper.addError
package:stream_channel/src/guarantee_channel.dart 144:14     _GuaranteeSink._addError
package:stream_channel/src/guarantee_channel.dart 135:5      _GuaranteeSink.addError
package:flutter_tools/src/test/flutter_platform.dart 566:27  FlutterPlatform._startTest
===== asynchronous gap ===========================
dart:async/zone.dart 1053:19                                 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 71:23                      _asyncThenWrapperHelper
package:flutter_tools/src/test/flutter_platform.dart         FlutterPlatform._startTest
package:flutter_tools/src/test/flutter_platform.dart 368:36  FlutterPlatform.loadChannel
package:flutter_tools/src/test/flutter_platform.dart 321:46  FlutterPlatform.load
===== asynchronous gap ===========================
dart:async/zone.dart 1053:19                                 _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 71:23                      _asyncThenWrapperHelper
package:test_core/src/runner/loader.dart                     Loader.loadFile.<fn>
package:test_core/src/runner/load_suite.dart 98:31           new LoadSuite.<fn>.<fn>
===== asynchronous gap ===========================
dart:async/zone.dart 1045:19                                 _CustomZone.registerCallback
dart:async/zone.dart 962:22                                  _CustomZone.bindCallbackGuarded
dart:async/timer.dart 52:45                                  new Timer
dart:async/timer.dart 89:9                                   Timer.run
dart:async/future.dart 172:11                                new Future
package:test_api/src/backend/invoker.dart 399:21             Invoker._onRun.<fn>.<fn>.<fn>

Otherwise if I go one by one it is running all good

OS: MacOS Catalina
Flutter & Dart: 3.5.1

in debugger in flutter in testing is bug

Most helpful comment

As a workaround, if you add "noDebug": true to the launch.json, it should fix it (albeit at the expense of debugging, and a warning from VS Code that it's not a valid option).

All 7 comments

I don't see this - though I'm not on Catalina yet.

Does this reproduce for you on a new project created with the Flutter: New Project? If not, can you share a repro project that does crash?

If it does happen there, could you capture a log by running the Dart: Capture Logs command, ticking Flutter Test and Observatory (Debugger), then reproducing the issue - then stop the logging (from the notification) and attach the log here.

Thanks!

same issue on Mac Mojave, the issue is occasional, sometimes it happens others do not.

If you can capture a log, that may help track this down. If it doesn't happen enough to be easy to log when it does, you can enable flutter test and debugger logs to record all the time, then grab a copy when of them when you next see it (the files will be overwritten on each run). Thanks!

Oh, when setting log files for this, you may want to include ${name} in the log file name (see https://dartcode.org/releases/v3-7/#other-improvements) since "Run All Tests" runs each suite concurrently so if there are multiple you'll want them to write separate log files.

This came up in https://github.com/Dart-Code/Dart-Code/issues/1673#issuecomment-573334259 and I was able to repro (once, at least - subsequent runs worked - I think there may be a race).

Ok, I can only repro this using launch.json and not with the Run All Tests command. The reason for this is that Run All Tests runs without the debugger, but setting up launch.json as as described at https://github.com/Dart-Code/Dart-Code/issues/1673#issuecomment-573334259 will run in debug mode, but in a single debug session (and that fails due to multiple VM services).

I don't think there's going to be an easy way to handle this.

As a workaround, if you add "noDebug": true to the launch.json, it should fix it (albeit at the expense of debugging, and a warning from VS Code that it's not a valid option).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mayorbyrne picture mayorbyrne  路  5Comments

shamrin picture shamrin  路  5Comments

mccadi picture mccadi  路  3Comments

rgb1380 picture rgb1380  路  3Comments

DanTup picture DanTup  路  4Comments