[beta][dartdev] Run hooks for dev dependencies in `dart run`

Issue description: When running `test_with_coverage` the hooks for
packages in dev dependencies were not run, leading to failed tests
when dev dependencies contain code assets.
What is the fix: Run the hooks for dev dependencies as well.
Why cherry-pick: Users workflows with coverage stop work when one of
their dev dependencies uses code assets.
Risk: Low, this fix has landed on the main channel and is tested on the same infrastructure.
Issue link: https://github.com/dart-lang/tools/issues/2237

Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/462980
Change-Id: I752a31ca099609722f5fc618db38c6ce0f2f3059
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464682
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart
index 01db1fd..512493c 100644
--- a/pkg/dartdev/lib/src/commands/run.dart
+++ b/pkg/dartdev/lib/src/commands/run.dart
@@ -413,7 +413,10 @@
           packageConfigUri: packageConfigUri,
           packageConfig: packageConfig,
           runPackageName: runPackageName,
-          includeDevDependencies: false,
+          // Enable accessing assets of dev dependencies in the debugger and
+          // enabling commands such as `dart run test` and `dart run
+          // coverage_with_test` that rely on having dev dependencies.
+          includeDevDependencies: true,
           verbose: verbose,
           dataAssetsExperimentEnabled: dataAssetsExperimentEnabled,
         );
diff --git a/pkg/dartdev/test/native_assets/run_test.dart b/pkg/dartdev/test/native_assets/run_test.dart
index dc53686..0d9d1be 100644
--- a/pkg/dartdev/test/native_assets/run_test.dart
+++ b/pkg/dartdev/test/native_assets/run_test.dart
@@ -97,6 +97,31 @@
     });
   });
 
+  for (final subcommand in ['test', 'test/my_test.dart']) {
+    test('dart run $subcommand (dev_dependency_with_hook)',
+        timeout: longTimeout, () async {
+      await nativeAssetsTest('dev_dependency_with_hook', (packageUri) async {
+        final result = await runDart(
+          arguments: [
+            'run',
+            subcommand,
+          ],
+          workingDirectory: packageUri,
+          logger: logger,
+        );
+        expect(
+          result.stdout,
+          stringContainsInOrder(
+            [
+              'native add test',
+              'All tests passed!',
+            ],
+          ),
+        );
+      });
+    });
+  }
+
   test('dart run some_dev_dep', timeout: longTimeout, () async {
     await nativeAssetsTest('native_add', (packageUri) async {
       final result = await runDart(
@@ -109,7 +134,7 @@
         logger: logger,
       );
       // It should not build native_add for running ffigen.
-      expect(result.stdout, isNot(contains('build.dart')));
+      expect(result.stdout, isNot(contains('Running build hooks')));
     });
   });