Closed
Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, the previous version in which this bug was not present was: Any time before PR #11974Description
A clear and concise description of the problem...🔬 Minimal Reproduction
- ng new test-app
- create packages/test-package outside of src folder
- add there simple test.component.ts and test.component.spec.ts
- Modify test.ts file and add context of 'packages directory
replace
const context = require.context('./', true, /\.spec\.ts$/);
context.keys().map(context1);
with
const context1 = require.context('../packages', true, /\.spec\.ts$/);
const context2 = require.context('./', true, /\.spec\.ts$/);
context1.keys().map(context1);
context2.keys().map(context2);
-
Add "../packages/**/*.spec.ts", to tsconfig.spec.json in "include" section
-
Run
ng test --code-coverage
and open coverage/index.html
🔥 Exception or Error
No error but the files outside the directory are not included in the coverage report.
Anything else relevant?
This was reported previously on issue #12474. They simply dismissed it as saying only files under sourceRoot
are listed on the coverage report. Having the intended behavior be where tests from outside sourceRoot
are ran but not included in the coverage report seems counterintuitive. They should either both be ran and included in the coverage report or not included in either place.