在VSCODE上运行所有测试时出现Flutter SIGINT错误

时间:2019-10-27 20:21:53

标签: testing flutter visual-studio-code sigint

当尝试从VSCODE上的flutter / dart中“运行所有测试”时,出现SIGINT错误,并且在文件上“加载”时测试完成,只有第一个可以。问题是,如果我一个接一个地运行测试,不会发生相同的事情。

loading /Users/marciomontenegro/Documents/Projects/mel/test/domain/usecases/sign_in_test.dart:

ERROR: Failed to load "/Users/marciomontenegro/Documents/Projects/mel/test/domain/usecases/sign_in_test.dart":
Shell subprocess terminated by ^C (SIGINT, -2) before connecting to test harness.
Test: /Users/marciomontenegro/Documents/Projects/mel/test/domain/usecases/sign_in_test.dart
Shell: /Users/marciomontenegro/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester


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>

1 个答案:

答案 0 :(得分:1)

仅找到有关此问题的一些信息。 来自https://github.com/Dart-Code/Dart-Code/issues/2082

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 #1673 (comment) 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).