tools icon indicating copy to clipboard operation
tools copied to clipboard

Pass test locations to test/groups

Open DanTup opened this issue 9 months ago • 3 comments

pkg:test provides the locations of tests in the JSON reporter. We use these in VS Code to provide navigation to tests (and VS Code also shows failure messages inline against those tests).

Those locations are computed by pkg:test by looking at the call stack when group() and test() are called, and then walking up to the first frame from the suite file. For test_reflective_loader this results in all tests being attributed to the calls to defineReflectiveSuite().

I've made a change to pkg:test to support passing custom locations to test/group. Once that's released, pkg:test_reflective_loader can be updated to provide those locations when it calls group/test.

I'm happy to make this change once pkg:test rolls out, I'm just recording the issue here in the meantime.

Related:

  • https://github.com/Dart-Code/Dart-Code/issues/5480 - original Dart-Code issue
  • https://github.com/dart-lang/test/issues/2029 - related pkg:test issue
  • https://github.com/dart-lang/test/pull/2481 - change to pkg:test to support custom test locations

DanTup avatar Apr 30 '25 11:04 DanTup

once pkg:test rolls out

Do we have a timeline for this release? I'm not trying to rush anyone here, just trying to understand if we have this information anywhere.

FMorschel avatar May 12 '25 19:05 FMorschel

Releases were published a short while ago :-)

https://github.com/dart-lang/test/pull/2495 https://pub.dev/packages/test

I haven't started on the pkg:test_reflective_loader changes yet, but I don't expect them to take long so may get to them this week.

DanTup avatar May 12 '25 20:05 DanTup

I've opened a PR for this at https://github.com/dart-lang/tools/pull/2090

DanTup avatar May 13 '25 10:05 DanTup

@scheglov thanks!

My main motivation here is to roll this into the SDK which I think just pulls this whole repo from a git hash, so there's no urgency to publish the release for this (if it's even required, from the comments above I wonder if it's automated).

DanTup avatar May 22 '25 16:05 DanTup