Skip to content

Build Failure with Dart Test's Tags Annotation #1480

Open
@PvtPuddles

Description

@PvtPuddles

When using the Tags annotation for dart test, build runner fails with the following exception:

[SEVERE] json_serializable on test/integration_test.dart:

Could not resolve annotation for `library asset:my_project/test/integration_test.dart`.

I was able to reproduce the issue by:

  • Creating test/integration_test.dart (below)
  • Running builder runner
    • It didn't fail the first time, so I modified the file and ran it again, which then triggered the above build failure.

test/integration_test.dart:

@Tags(['integration-test']) // <-- Causes build_runner failure
library;

import 'package:test/test.dart';

void main() {
  test("example test", () {});
}

As a workaround, you can add the following to your build.yaml:

targets:
  $default:
    sources:
      exclude:
        - test/integration_test.dart

Of course, this only works if your tests don't rely on build_runner, so a more permanent solution would be most welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions