WebStorm DartUnit with test api, run/debug error

151 Views Asked by At

I'm using WebStorm IDE and test api which is named unittest before. The test works fine using the command:

pub run test:test test/sample.dart

/test/sample.dart

library testproject.sample;

import 'package:test/test.dart';

void main() {
  test('Testing', () {
    expect(true, isTrue);
  });
}

but when i tried to run/debug using WebStorm DartUnit the test, the console shows this error:

Unhandled exception:
Uncaught Error: Load Error: FileSystemException: Cannot open file, path = 'C:\Users\dummy\Desktop\testproject\packages\unittest\unittest.dart' (OS Error: The system cannot find the path specified.
, errno = 3) 
1

There are 1 best solutions below

0
On

WebStorm is still hardwired to the old unittest package. There is an open issue to fix this https://youtrack.jetbrains.com/issue/WEB-16053

You can however execute Dart test scripts using the new test package like any other Dart script, to be able to use the debugger. If you use custom HTML pages for your tests, you need to replace the x-dart-test link to a proper Dart script tag to be able to execute it from WebStorm.