When I try to run the following test:
import 'package:my_project/my_file.dart';
import 'package:test/test.dart';
void main() {
group('int extensions:', () {
expect(1.digits(), 1);
expect(10.digits(), 2);
expect(100.digits(), 3);
});
}
I get the following error message:
Failed to load "test/my_file_test.dart": Instance of 'OutsideTestException'
The answer is probably obvious most people coming here now, but it took me a while to realize what was wrong. I'm adding my answer below for other people with the same problem.