Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using mirrors while testing #29868

Closed
kdy1 opened this issue Mar 24, 2019 · 2 comments
Closed

Allow using mirrors while testing #29868

kdy1 opened this issue Mar 24, 2019 · 2 comments

Comments

@kdy1
Copy link

kdy1 commented Mar 24, 2019

Steps to Reproduce

test/game/rtmp.dart:

import 'package:socket_io/socket_io.dart';
import 'package:socket_io_client/socket_io_client.dart' as client;
import 'package:test/test.dart';

void main() {
  group("MultiPlayer", _tests);
}

void _tests() {
  Server server;

  List<client.Socket> clients;
  setUp(() {
    server = new Server();
    server.listen(3000);

    clients = List.generate(
      4,
      (int i) => client.io("https://localhost:3000"),
    );
  });

  tearDown(() {
    server.close();
    clients.forEach((v) => v.close());
  });

  test("works", () async {});
}
  1. flutter test ./test/game/rtmp_test.dart

Logs

Shell: [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: error: import of dart:mirrors with --enable-mirrors=false
Shell: [ERROR:flutter/shell/common/engine.cc(176)] Could not prepare to run the isolate.
Shell: [ERROR:flutter/shell/common/engine.cc(123)] Engine not prepare and launch isolate.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(199)] Could not launch the engine with configuration.
[✓] Flutter (Channel beta, v1.3.8, on Mac OS X 10.14.3 18D109, locale ko-KR)
    • Flutter version 1.3.8 at /Users/kdy1/flutter
    • Framework revision e5b1ed7a7f (2주 전), 2019-03-06 14:23:37 -0800
    • Engine revision f4951df193
    • Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/kdy1/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/kdy1/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[!] Android Studio (version 3.3)
    • Android Studio at /Users/kdy1/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/182.5314842/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
    • IntelliJ at /Users/kdy1/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 33.4.2
    • Dart plugin version 183.5912.23

[!] VS Code (version 1.32.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • iPhone XR • 01668E55-3AEE-4D2D-AE53-24A40A2F286E • ios • iOS 12.1 (simulator)


Note that test works with flutter packages pub run ./test/game/rtmp_test.dart

@jonahwilliams
Copy link
Member

flutter test runs tests via a headless flutter device, the flutter_tester, which doesn't support mirrors. If you have tests that use mirrors and not dart:ui, then running them via flutter packages pub run test_name is supported, since this runs in the dart vm.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants