coverage icon indicating copy to clipboard operation
coverage copied to clipboard

Support for local imports with package

Open jtmcdole opened this issue 9 years ago • 0 comments

If the user is using package:// in their tests, coverage will not be reported because the "lib" is not appended to the path. Here's a dirty hack to get this working:

pub.bat run coverage:format_coverage --in coverage.json --package-root=/c/Users/codefu/dart/  --report-on=lib  | less

In lib/resolver.dart:

      var resolved = resolveSymbolicLinks(p.join(packageRoot, path));
      if (resolved == null && path.contains('/')) {
        // try adding lib for projects that use package:lib
        path = path.replaceFirst('/', '/lib/');
        resolved = resolveSymbolicLinks(p.join(packageRoot, path));
      }
      return resolved;

Output as expected!

      2|  ArdProto(this.port, {this.debug: false}) {
      2|    _startReading();
       |  }

If you are fine with this, I can make a pull request.

jtmcdole avatar Jan 18 '16 19:01 jtmcdole