Improve error handling for incorrect test namespaces
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3540378. --> Reported by: [alex.skrypnyk](https://www.drupal.org/user/620694) >>> <p>When running:</p> <pre>vendor/bin/rector --clear-cache --dry-run</pre><p>on a Drupal project with <code>rector/rector</code> and <code>palantirnet/drupal-rector</code>, I consistently get the following error:</p> <pre>Error: [ERROR] RecursiveDirectoryIterator::__construct(/app/web/modules/contrib/webform/modules/webform_cards/tests/src/FunctionalJavaScript): Failed to open directory: No such file or directory</pre><p>I traced this to <code>vendor/palantirnet/drupal-rector/config/drupal-phpunit-bootstrap-file.php</code> when it attempts to load files.</p> <p>The root cause appears to be a namespace mismatch in one of the contrib modules. All test classes in <code>webform/modules/webform_cards/tests/src/FunctionalJavaScript</code> (note the uppercase &ldquo;S&rdquo; in <code>FunctionalJavaScript</code>) use the incorrect namespace:</p> <pre>Drupal\Tests\webform_cards\FunctionalJavascript</pre><p>(with a lowercase &ldquo;s&rdquo; in <code>FunctionalJavascript</code>).</p> <p>There is an <a href="https://www.drupal.org/project/webform/issues/3441905">existing issue</a> in the Webform project to address the namespace, but I&rsquo;m wondering if <code>palantirnet/drupal-rector</code> should handle such cases more gracefully&mdash;perhaps by throwing a clearer error or skipping the affected test classes.</p> > Related issue: [Issue #3441905](https://www.drupal.org/node/3441905)
issue