I am using angular library with secondary entrypoint My library folder structure is
And I used this command ng test my-library --code-coverage
The secondary entry points' service test doesn't execute.
Then I tried, changing "test.ts" context path('./') with '../' which is under the src folder. Tests were executed but code coverage doesn't create.
How can I execute tests for a secondary entry point?
That is because the source root of your project is pointing to projects/your-library/src and when running tests it does not take into account the other entry points.
To fix this just change the sourceRoot property in your "angular.json" file to projects/your-library, everything else should still work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With