My use case is to generate coverage report for Angular project by excluding certain files, I've excluded those files in angular.json
it's working as expected. However I'm looking to exclude them via ng test
command
ng test project --source-map=false --browsers=Chrome --code-coverage --watch=true --progress=true --code-coverage-exclude=['projects/folder1/template1/**']
Above command isn't working.
As stated in Angular docs about Angular CLI, to specify array options to the CLI, the syntax is to provide the argument name and then the options separated by space. Hence your command would be
ng test project --source-map=false --browsers=Chrome \
--code-coverage --watch=true --progress=true \
--code-coverage-exclude 'projects/folder1/template1/**'
And you could add more arguments to --code-coverage-exclude
by:
ng test project \
--code-coverage-exclude 'projects/folder1/template1/**' 'projects/folder1/template2/**'
ng test project \
--code-coverage-exclude 'projects/folder1/template1/**' \
--code-coverage-exclude 'projects/folder1/template2/**'