lundi 29 juillet 2019

Unit test compiled dist Angular component?

So I've been looking at some examples over how people unit test their components. It seems that the tests are never really tested on the dist compiled code which ends up in dist/out-tsc but rather the source code that sits in src.

A lot of the unit tests I see do the following:

import { ExampleComponent } from '../../../client/app/components/example-comp/example.component';

This implies that unit testing is done after for example TypeScript compiling but before compiling the app.

I would like to do a npx ng build and then initiate tests on the compiled code which is generated in the dist/out-tsc directory and have nyc coverage. That way I know that the code I will be deploying has been tested.

I'm starting to get the thought that frontend testing is divided into the following three.

  • Unit test -> Done on src code
  • Integration test -> Done on src code
  • E2E test -> Done on compiled code

Would this assumption be correct?

Aucun commentaire:

Enregistrer un commentaire