How to configure the Angular Automatic Test with Karma Jasmine and Webpack

0

I wanted to know how I can configure the tests of an app developed with Angular. Because it does not use angular-cli, but the configuration of the app is done completely through webpack, where it has configured the routes management with the angular library-router-loader to generate js files by modules. For the tests I want to use karma with jasmine, where I do all the karma settings. But when I run the tests, I get the response in Karma "Failed: Can not resolve all parameters for SigninComponent: (?)." If I notice the configuration of the spec.ts I see that the provider to which the component refers is configured

            describe('Signin Component', () => {
              let fixture: ComponentFixture<SigninComponent>;

              beforeEach(() => destroyPlatform());

              beforeEach(async(() => {

                return TestBed
                  .configureTestingModule({
                    declarations: [SigninComponent],
                    imports: [
                      FormsModule
                    ],
                    providers: [StorageService]
                  })
                  .compileComponents()
                  .then(() => {
                    fixture = TestBed.createComponent(SigninComponent);
                  });
              }));
            });

I understand that there is a configuration problem that causes the component not to find the provider, but after a month of research I can not find the Return.

    
asked by mpanichella 29.05.2018 в 02:32
source

0 answers