Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

setUpInjector throws DynamicMetadataExtractor not found #1508

Closed
MikeMitterer opened this issue Oct 2, 2014 · 7 comments
Closed

setUpInjector throws DynamicMetadataExtractor not found #1508

MikeMitterer opened this issue Oct 2, 2014 · 7 comments

Comments

@MikeMitterer
Copy link

Tried it with Angular 0.14 and the GH-Version from 141002
This:

testSignalService() {
    final Logger logger = new Logger("test.SignalService");

        group('> SendSignal', () {

            setUp(() {
                amock.setUpInjector();
            });
            tearDown(amock.tearDownInjector);

            test('> Anugular', () {
                expect(0, equals(0));
            }); // end of 'Anugular' test

        }); // End of 'SendSignal' group
}

throws

Setup failed: Caught Type 'DynamicMetadataExtractor' not found in generated typeFactory maps. Is the type's constructor injectable and annotated for injection? #0 GeneratedTypeFactories.parameterKeysFor (package:di/src/reflector_static.dart:26:5) #1 Binding.bind (package:di/src/module.dart:61:49) #2 Module.bindByKey (package:di/src/module.dart:136:17) #3 Module.bind (package:di/src/module.dart:124:14) #4 _DynamicApplication._DynamicApplication (package:angular/application_factory.dart:62:15) #5 applicationFactory (package:angular/application_factory.dart:81:41) #6 setUpInjector.<anonymous closure> (package:angular/mock/test_injection.dart:153:35) #7 _LocalInstanceMirror.invoke (dart:mirrors-patch/mirrors_impl.dart:539) #8 _LocalClosureMirror.apply (dart:mirrors-patch/mirrors_impl.dart:569) #9 _SpecInjector._invoke (package:angular/mock/test_injection.dart:80:20) #10 _SpecInjector.module (package:angular/mock/test_injection.dart:37:29) #11 setUpInjector (package:angular/mock/test_injection.dart:151:30) #12 testSignalService.<anonymous closure>.<anonymous closure> (http://localhost:63342/MobileAdvertising/WebApp.Base.UI.Angular/test/unit/angular/services/SignalService_test.dart:12:36) #13 _run.<anonymous closure> (package:unittest/src/test_case.dart:94:40) #14 _rootRunUnary (dart:async/zone.dart:836) #15 _CustomZone.runUnary (dart:async/zone.dart:748) #16 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488) #17 _Future._propagateToListeners (dart:async/future_impl.dart:571) #18 _Future._completeWithValue (dart:async/future_impl.dart:331) #19 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393) #20 _rootRun (dart:async/zone.dart:829) #21 _CustomZone.run (dart:async/zone.dart:740) #22 _CustomZone.runGuarded (dart:async/zone.dart:648) #23 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:673) #24 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41) #25 _asyncRunCallback (dart:async/schedule_microtask.dart:48) #26 _handleMutation (dart:html:39006) DECLARED AT:null
@vicb
Copy link
Contributor

vicb commented Oct 2, 2014

Hard to guess what could be wrong without the context of your test.

The test suite pass on both 0.14 and master. Must be something wrong with your setup (that is not included in the ticket).

Closing are there is nothing we can do with a repro case - try to make it as small as possible and re-open when provided.

@vicb vicb closed this as completed Oct 2, 2014
@MikeMitterer
Copy link
Author

Hmmm - I found out that it has something todo with either pub serve or IntelliJ with pub serve. After "invalidate cache / restart" in IntelliJ this exception is gone - got several others instead. Filed a bug report at JetBrains Issue tracker. If I try it with "python -m SimpleHTTPServer $PORT" - it works!!!! All the stupid error messages are gone...

@vicb
Copy link
Contributor

vicb commented Oct 2, 2014

@MikeMitterer Pls note that there is a difference in serving the raw files and going through pub serve: when you serve the raw files, the transformers are not executed and run the the dynamic version of angular (ie dynamic as in DynamicMetadataExtractor, using reflection).

When you serve the app through pub, the transformers are executed (they create factories for the DI and extract the metadata from HTML / Dart code).

One thing that could go wrong with pub serve is that you forget to include the angular transfomer in your pubspec.yaml. Check the one from the example folder.

@MikeMitterer
Copy link
Author

I'm running some unit tests.

I tried:

transformers:
- angular
    html_files:
      - test/unit/index.html

But with the same result. (I already had transformers: -angular in my yaml before...)

@MikeMitterer
Copy link
Author

@vicb + thx for clarifying how pub serve handles files. I'm really waiting for Chrome integrating the Dart-VM. pub serve and all these transformers just sucks.

@vicb
Copy link
Contributor

vicb commented Oct 2, 2014

@MikeMitterer Chrome integrating the DartVM is not exclusive is pub build. One of the obvious reason is that there are other browsers out there but Dart could also benefit from being transformed.
Transformers are not easy to grasp but are a really powerful tool.

@MikeMitterer
Copy link
Author

@vicb Thanks for your help. We will see what the future brings according to Transformers but I've the feeling that Dart / DartVM / pub??? left here the single source of truth. If I get different results on different servers thats a huge!!! problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants