Search code examples
dartwebstormdart-polymer

Running a simple Dart test in WebStorm 10.0.4


This should be trivial but it is not working as I think it should. I am new to WebStorm.

I have a simple test taken from Dart's new test offering at https://pub.dartlang.org/packages/test

.dart

import "package:test/test.dart";

void main() {
  test("String.split() splits the string on the delimiter", () {
    var string = "foo,bar,baz";
    expect(string.split(","), equals(["foo", "bar", "baz"]));
  });

  test("String.trim() removes surrounding whitespace", () {
    var string = "  foo ";
    expect(string.trim(), equals("foo"));
  });
}

Running this simple test gives the following exception:

J:\dart\dart-sdk\bin\dart.exe --ignore-unrecognized-flags --checked --package-root=J:\workspace\epimss\dart\epimss_shared\packages --enable-vm-service:60110 --trace_service_pause_events C:\Users\st.clair.clarke\AppData\Local\Temp\jetbrains_unit_config.dart
Testing started at 3:07 AM ...
Observatory listening on http://127.0.0.1:60110
Unhandled exception:
No top-level setter 'unittestConfiguration=' declared.

NoSuchMethodError: method not found: 'unittestConfiguration='
Receiver: top-level
Arguments: [Instance of 'JetBrainsUnitConfig']
#0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:188)
#1      main (file:///x:/Users/zang/AppData/Local/Temp/jetbrains_unit_config.dart:10:3)
#2      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)

Process finished with exit code 255

The problem seems to be the line unittestConfiguration = config; in the jetbrains configuration - something is expected for the config.

Any help is appreciated.


Solution

  • According to this issue, test package is not yet supported by WebStorm's testing framework.

    You have two ways right now:

    1. Run it as usual dart application, not as a test
    2. Use deprecated unittest package instead of test until issue is resolved.