Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I always thought that we did not have any support to exclude tests since passing a similar glob path in include would work but it never worked in exclude!!
Seems like the include option in the angular builder for karma is normalized, while the exclude is passed directly to the glob method.
I see there are a lot of changes to the include strings that are made before it is used to match the files.
But, the exclude seems to be used directly without any modifications.
I think the exclude should have at least been normalized like the include for common user errors like using back-slashes or the relativeProjectRoot.
https://github.com/angular/angular-cli/blob/b479063ab5ef625a5ee883bf5cc335572bdcb83e/packages/angular_devkit/build_angular/src/builders/karma/find-tests-plugin.ts#L112 Opens in new window or tab
I had included the relative project root (src/) in include and it worked as expected, but when I included the same in exclude it didn't work.
As a user, I would think that include and exclude strings would work the same way, but in fact, it is not.
Also, I can't find this behavior documented anywhere.
I see only 2 special cases documented here

Can we do something here?
Minimal Reproduction
Using relative project root works with include but not with exclude
The configuration mentioned is used in the angular.json

Exception or Error
No response
Your Environment
Angular CLI: 15.2.10
Node: 18.10.0
Package Manager: npm 8.19.2
OS: win32 x64
Angular: 15.2.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.1502.10
@angular-devkit/build-angular 15.2.10
@angular-devkit/core 15.2.10
@angular-devkit/schematics 15.2.10
@angular/cdk 15.2.9
@angular/material 15.2.9
@angular/material-moment-adapter 15.2.9
@schematics/angular 15.2.10
rxjs 6.6.7
typescript 4.9.5
Anything else relevant?
No response
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I always thought that we did not have any support to
excludetests since passing a similar glob path inincludewould work but it never worked inexclude!!Seems like the
includeoption in the angular builder for karma is normalized, while theexcludeis passed directly to the glob method.I see there are a lot of changes to the
includestrings that are made before it is used to match the files.But, the
excludeseems to be used directly without any modifications.I think the
excludeshould have at least been normalized like theincludefor common user errors like using back-slashes or the relativeProjectRoot.https://github.com/angular/angular-cli/blob/b479063ab5ef625a5ee883bf5cc335572bdcb83e/packages/angular_devkit/build_angular/src/builders/karma/find-tests-plugin.ts#L112 Opens in new window or tab
I had included the relative project root (src/) in

includeand it worked as expected, but when I included the same inexcludeit didn't work.As a user, I would think that
includeandexcludestrings would work the same way, but in fact, it is not.Also, I can't find this behavior documented anywhere.
I see only 2 special cases documented here
Can we do something here?
Minimal Reproduction
Using relative project root works with

includebut not withexcludeThe configuration mentioned is used in the angular.json
Exception or Error
No response
Your Environment
Anything else relevant?
No response