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

Issue with angular 2 RC6 #97

Open
combmag-zz opened this issue Sep 10, 2016 · 4 comments
Open

Issue with angular 2 RC6 #97

combmag-zz opened this issue Sep 10, 2016 · 4 comments

Comments

@combmag-zz
Copy link

combmag-zz commented Sep 10, 2016

HI i have the following issue after i upgraded to rc6

previously the configuration was like the one below:

// karma-test-shim.js
...
System.import('angular2/testing').then(function(testing) {
  return System.import('angular2/platform/testing/browser').then(function(providers) {
    testing.setBaseTestProviders(
      providers.TEST_BROWSER_PLATFORM_PROVIDERS,
      [providers.TEST_BROWSER_APPLICATION_PROVIDERS, providers.CACHED_TEMPLATE_PROVIDER]);
  });
}).then(function() {
...

now when i upgraded to rc6 and changed to:

import { TestBed } from "@angular/core/testing";
import {
    BrowserDynamicTestingModule,
    platformBrowserDynamicTesting
} from "@angular/platform-browser-dynamic/testing";
import {
    RESOURCE_CACHE_PROVIDER
} from "@angular/platform-browser-dynamic";
`
TestBed.initTestEnvironment(
    BrowserDynamicTestingModule,
    platformBrowserDynamicTesting(RESOURCE_CACHE_PROVIDER)
);

i got an error that the html is not found and when i tried to debug it seems taht resource cache provider is never called..

am i missing something?

@jcamus
Copy link

jcamus commented Oct 5, 2016

They've broken so many things with this RC6 (and 2.0.0) it's a real nightmare! I'am still not able to run my unit tests... my karma conf is broken...

@meriturva
Copy link

@combmag i know....it is really old issue....but have you found a solution how to configure RESOURCE_CACHE_PROVIDER on init phase?
Thanks

@combmag-zz
Copy link
Author

@meriturva afaik RESOURCE_CACHE_PROVIDER should be provided to TestBed.configureCompiler and not to initTestEnvironment that's what fixed the issue.

@meriturva
Copy link

meriturva commented Jun 20, 2017

Anyway i have developed a simple karma pre-processor to fix template and avoid RESOURCE_CACHE_PROVIDER (so no change needed on our tests)

see: https://stackoverflow.com/questions/44539485/angular2-tests-and-resource-cache-provider-global

so thanks @combmag

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

No branches or pull requests

3 participants