Skip to content

Unfinished tests should be considered failing tests #2585

@gaaclarke

Description

@gaaclarke

reproduction

import 'package:test/test.dart';

bool runTest = true;

void main() {
  _doTest('some test', () async {
    int value = await _load();
    expect(value, 43);
  });
}

void _doTest(String name, Function() callback) {
  test(name, () {
    if (!runTest) {
      print('skipped.');
      return;    
    }
    callback();
  });
}

Future<int> _load() async {
  await Future.delayed(Duration(seconds: 10));
  return 42;
}

observed

The tests pass fine.

expected

Tests that aren't finished by the time the process exits should be considered failing.

notes

I actually requested that this failure be fixed at a language level but that approach sounds unlikely to bear fruit: dart-lang/language#4608

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions