Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

tsconfig.app.json 'includes' does not respect glob patterns for cypress

未关闭
#24,855 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, cypress, typescript, webpack

调研方向

在链接的仓库中使用 npx cypress open 重现失败,然后检查 tsconfig.app.jsoncypress.config.ts 以及 @ngtools/webpack 报告的 Angular 构建路径。确认 Cypress 组件文件是如何被选入 TypeScript 编译的。通过 include 指定 Cypress 文件后,组件测试能够打开且不再出现未包含在编译中的错误,即表示完成。

由索引模型根据 Issue 内容生成。

描述

area: @ngtools/webpack needs: investigation
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
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)
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

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
17 小时 25 分钟
30 天内合并 PR
183

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。