Skip to content

"Cannot read properties of null (reading 'startsWith')" running tests #5930

Closed

Description

@DanTup

Running test\src\services\correction\fix\add_static_test.dart with F5 in VS Code, I see this error:

Image

In this code:

const path = maybeUriToFilePath(useRootLocation ? evt.test.root_url : evt.test.url);

It appears that evt.test.root_url is undefined but evt.test.url is null, and maybeUriToFilePath handles undefined but not null.

{"seq":2273,"type":"event","body":{"test":{"id":5,"name":"AddStaticTest test_multipleFields","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":true,"skipReason":"does not have \"solo\""},"line":null,"column":null,"url":null},"type":"testStart","time":1055},"event":"dart.testNotification"}

Activity

  1. added this to the v3.130.0 milestone on Feb 25, 2026
  2. added
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Feb 25, 2026
  3. DanTup commented on Feb 25, 2026

    @DanTup
    MemberAuthor

    I'm surprised that we're not getting the location for this, maybe there's also a bug somewhere like pkg:test?

    {"seq":2273,"type":"event","body":{"test":{"id":5,"name":"AddStaticTest test_multipleFields","suiteID":0,"groupIDs":[2,3],"metadata":{"skip":true,"skipReason":"does not have "solo""},"line":null,"column":null,"url":null},"type":"testStart","time":1055},"event":"dart.testNotification"}

  4. DanTup commented on Feb 25, 2026

    @DanTup
    MemberAuthor

    Handled the nulls, and opened #5931 as a reminder to investigate why we got nulls in this specific case (seems like we should have a location).

  5. DanTup commented on Mar 2, 2026

    @DanTup
    MemberAuthor

    I'm reverting this fix because #5938 is arguably worse, but this is still an exception we need to fix, so re-opening this and will re-apply the fix after the release, and think about how to fix #5938 better.

  6. reopened this on Mar 2, 2026
  7. modified the milestones: v3.130.0, v3.132.0 on Mar 2, 2026
  8. DanTup commented on Mar 2, 2026

    @DanTup
    MemberAuthor

    Reverting didn't solve the issue because the skips now have locations and don't trigger the bug. So, I'm keeping this fix in.

  9. modified the milestones: v3.132.0, v3.130.0 on Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions