alternatives to change TestBed configurations without creating the test.ts files
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### Which @angular/* package(s) are relevant/related to the feature request?
core
### Description
with Angular 15, now the `test.ts` file doesn't get generated by default, so it's not an easy task to change the `TestBed` configurations for example to enable `errorOnUnknownElements`
it will also be nice if we can change the pattern of the tests
### Proposed solution
to add the configurations inside the `angular.json` files in the options section of test
something like
```
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [],
"errorOnUnknownElements": true, <---
"errorOnUnknownProperties": true, <---
"pattern": "\.custom-spec\.ts$" <---
}
```
### Alternatives considered
to be able to enable them globally from any script (to create a js file and add it to the scripts of the test) with something like
```
getTestBed().setoptions({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
pattern: /\.custom-spec\.ts$/
});
```
コントリビューションガイド
調査の方向性
まず、angular.json のテストオプションがどのように処理され、test.ts のブートストラップがどのように生成または置き換えられるかを追跡します。要求された TestBed 設定とカスタムテストパターンを受け入れ条件として使用します。プロジェクトが test.ts ファイルを作成せずにそれらを設定できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- testing, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100