tsconfig.app.json 'includes' does not respect glob patterns for cypress
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 162
描述
### Which @angular/* package(s) are the source of the bug?
Don't known / other
### Is this a regression?
Yes
### Description
I've included a link to repo that provides the basic setup. To test the issue, you just need to run `npx cypress open` with the setup I've created, then click on 'component tests'. Now click on 'app.ts'. The error is provided below - essentially it's asking me to include the app.ts file in either the 'files' or 'include' property of the tsconfig.
This is what **works** when added to `tsconfig.app.json`:
```
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"cypress/component/app.ts"
],
"include": [
"src/**/*.d.ts",
]
}
```
This is what **fails** when added to `tsconfig.app.json`:
```
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
],
"include": [
"src/**/*.d.ts",
"cypress/**/*.ts",
]
}
```
I checked multiple sources, and cannot see any error in the cypress glob pattern added to `include`.
Note, this also fails:
```
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
],
"include": [
"src/**/*.d.ts",
"cypress/component/app.ts"
]
}
```
It appears to be a bug - I can't define it in any other terms at this point, as it's a basic example, applied to a boilerplate Angular application, with virtually no additions/tweaks outside of the this app.ts test.
### Please provide a link to a minimal reproduction of the bug
https://github.com/CMadden8/cypress-angular-test
### Please provide the exception or error you saw
```true
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: C:\[omitted path]\cypress\component\app.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
```
### Please provide the environment you discovered this bug in (run `ng version`)
```true
Angular CLI: 15.2.2
Node: 16.14.2
Package Manager: npm 8.5.0
OS: win32 x64
Angular: 15.2.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1502.2
@angular-devkit/build-angular 15.2.2
@angular-devkit/core 15.2.2
@angular-devkit/schematics 15.2.2
@schematics/angular 15.2.2
rxjs 7.8.0
typescript 4.9.5
```
### Anything else?
@badeball/cypress-cucumber-preprocessor and ts-loader were installed alongside cypress, and configured for component testing within cypress.config.ts
貢獻指南
研究方向
在連結的儲存庫中使用 `npx cypress open` 重現失敗,然後檢查 `tsconfig.app.json`、`cypress.config.ts` 以及 `@ngtools/webpack` 回報的 Angular 建置路徑。確認 Cypress 元件檔案如何被選入 TypeScript 編譯。透過 `include` 指定 Cypress 檔案後,元件測試能夠開啟且不再出現未包含在編譯中的錯誤,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, cypress, typescript, webpack
- 領域
- build-system, cli, testing
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100