jeudi 29 novembre 2018

How to ignore spec files and mock files in production build in Angular 6

I m trying to compile in production my angular application and I m receiving this error:

Cannot determine the module for class TranslateMockPipe in /src/testing/translate.service.spec.ts! Add TranslateMockPipe to the NgModule to fix it.

this TranslateMockPipe class is a common class that I declared and I m using it in all my test files in order to avoid repeating the same line of code in all the test cases

the code of the class:

@Pipe({ name: "translate" })
class TranslateMockPipe {
    transform = (ss) => ss
}

I m using it in my test like this:

TestBed.configureTestingModule({
            declarations: [
                DemoComponent,
                TranslateMockPipe
            ]
})

If I run the project everything goes well, and my test pass without issues but fail when I try to compile for production

How I can ignore this kind of fake classes for production build?

Aucun commentaire:

Enregistrer un commentaire