简体   繁体   中英

WebStorm 11 EAP - Dart Unit Test Throwing Errors

I've been using the Guinness test framework for some functional testing in my Dart library.

I think one of the new updates to either WebStorm or Dart SDK broke.

I have the following:

import 'package:guinness/guinness.dart';
import 'package:tickets/shared/schemas.dart';
import 'package:tickets/db/seeder.dart';
import 'package:tickets/db/db_config.dart';
import '../bin/mongo_model.dart';

main() {

  DbConfigValues config = new DbConfigValues();
  MongoModel model = new MongoModel(config.testDbName, config.testDbURI, config.testDbSize);

  //A Test DTO
  RouteDTO routeDTO = new RouteDTO()..duration=120..price1=90.00..price2=91.00..price3=95.00..seats=7;

  describe("The Ticket MongoModel", () {

    it("should create a record DTO and write to the db", () {
      var originalID = routeDTO.id;
      return  model.createByItem(routeDTO).then(( var dto ) {
        expect(originalID).toBeNull();
        expect(routeDTO.id).toBeNotNull();
        expect(dto.id).toEqual(routeDTO.id);
      });
    });

  });
}

Which results in:

/usr/local/opt/dart/libexec/bin/dart --ignore-unrecognized-flags --checked --enable-vm-service:52158 --trace_service_pause_events /private/var/folders/br/4n3vt5lj0qq11xk0fdmjk9y80000gn/T/jetbrains_unit_config.dart
Testing started at 3:31 PM ...
Unhandled exception:
Could not resolve a package location for base at file:///private/var/folders/br/4n3vt5lj0qq11xk0fdmjk9y80000gn/T/jetbrains_unit_config.dart
#0      _handlePackagesReply (dart:_builtin:416)
#1      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
Observatory listening on http://127.0.0.1:52158

Process finished with exit code 255

Question: How do i get guiness working with WebStorm in 11EAP.

I suggest to run the test as a standard command line Dart application. You can create corresponding run configuration manually (Run | Edit Configurations | [+] | Dart Command Line App), or remove current DartUnit run configuraton (Run | Edit Configurations) and then right click the main file. You won't get test result tree this way, but you'll see test results in the IDE console.

According to Alexanders answer I found a solution for me - I'm using the bash plugin for this...

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM