fix lint registry timing (#2526)

diff --git a/test/rule_test.dart b/test/rule_test.dart
index 25baa5f..0c11f12 100644
--- a/test/rule_test.dart
+++ b/test/rule_test.dart
@@ -213,13 +213,13 @@
 
 void testRule(String ruleName, File file,
     {bool debug = true, String? analysisOptions}) {
-  registerLintRules(inTestMode: debug);
-
   test('$ruleName', () async {
     if (!file.existsSync()) {
       throw Exception('No rule found defined at: ${file.path}');
     }
 
+    registerLintRules(inTestMode: debug);
+
     var expected = <AnnotationMatcher>[];
 
     var lineNumber = 1;