karma-ng-html2js-preprocessor
karma-ng-html2js-preprocessor copied to clipboard
Issue with angular 2 RC6
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?
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...
@combmag i know....it is really old issue....but have you found a solution how to configure RESOURCE_CACHE_PROVIDER on init phase? Thanks
@meriturva afaik RESOURCE_CACHE_PROVIDER should be provided to TestBed.configureCompiler and not to initTestEnvironment that's what fixed the issue.
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