Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

alternatives to change TestBed configurations without creating the test.ts files

Đang mở
#24,345 6 bình luận 5 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript
Lĩnh vực
testing, tooling

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách các tùy chọn kiểm thử trong angular.json được xử lý và cách bootstrap của test.ts được tạo hoặc thay thế. Sử dụng các thiết lập TestBed được yêu cầu và mẫu kiểm thử tùy chỉnh làm các trường hợp chấp nhận; công việc được xem là hoàn tất khi các project có thể cấu hình chúng mà không cần tạo các tệp test.ts.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area: @angular-devkit/build-angular devkit/build-angular:karma feature feature: insufficient votes
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$/
});
Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
176

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.