vendredi 10 juin 2016

angular2 testing, error in ViewUtils when using setBaseTestProviders()

When using the method 'setBaseTestProviders(..)', an error pops up in the console.

We're using angular-2.0.0-rc.1.

The test (test/areas-list.component.spec.ts) is as follows:

import {setBaseTestProviders} from "@angular/core/testing";
import {ADDITIONAL_TEST_BROWSER_PROVIDERS, TEST_BROWSER_STATIC_PLATFORM_PROVIDERS} from '@angular/platform-browser/testing/browser_static';
import {BROWSER_APP_DYNAMIC_PROVIDERS} from '@angular/platform-browser-dynamic';

setBaseTestProviders([
    BROWSER_APP_DYNAMIC_PROVIDERS,
    ADDITIONAL_TEST_BROWSER_PROVIDERS,
], TEST_BROWSER_STATIC_PLATFORM_PROVIDERS);

describe('test test', () => {
   //Not really important
});

When I open the browser, the following error is shown in the console:

zone.js:323 Error: Error: Cannot resolve all parameters for 'ViewUtils'(RootRenderer, undefined @Inject(Token AppId), SanitizationService). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ViewUtils' is decorated with Injectable.
    at NoAnnotationError.BaseException [as constructor] (http://ift.tt/21bW399)
    at new NoAnnotationError (http://ift.tt/1WHNWme)
    at _extractToken (http://ift.tt/21bUPuB)
    at eval (http://ift.tt/1WHNvsa)
    at Array.map (native)
    at _dependenciesFor (http://ift.tt/21bUurT)
    at resolveReflectiveFactory (http://ift.tt/1WHNtAy)
    at resolveReflectiveProvider (http://ift.tt/21bTUuc)
    at Array.map (native)
    at Object.resolveReflectiveProviders (http://ift.tt/1WHNsww)
Evaluating http://ift.tt/21bUatc
Error loading http://ift.tt/21bUatc

Does somebody know what the problem is? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire